#include <fsLog.h>
Inheritance diagram for fs::sys::Log_t:
An extra effort was made to provide two key features: Individual log instances can be linked together and they can rest in different DLL modules. Before a module is connected, logged data are typically stored in log history. After connecting, the history is dumped into the main log and all future logged data are also redirected. The Fig. below shows such a module-based system.
The internal logic of Log_t recognizes special control sequences in the message. Prefix '!.' means warning, 'x.' means error. Postfix '@' is an explicit request for message break invoking through the FS_ASSERT_MSG macro.
Definition at line 76 of file fsLog.h.
Public Types | |
LOG_HIST = 0x00000001 | |
Keep records in history. | |
LOG_FILE = 0x00000002 | |
Log to a file. | |
LOG_STDOUT = 0x00000004 | |
Log to the standard output. | |
LOG_DBGOUT = 0x00000008 | |
Log through OutputDebugString. | |
LOG_RTMBRK = 0x00000010 | |
Enable runtime break. | |
enum | Mode_e { LOG_HIST = 0x00000001, LOG_FILE = 0x00000002, LOG_STDOUT = 0x00000004, LOG_DBGOUT = 0x00000008, LOG_RTMBRK = 0x00000010 } |
Configuration flags. More... | |
Public Member Functions | |
Log_t (unsigned int fMode, size_t uHist=1024, const char *pszFile="fs.log") | |
Initializes a new log instance using the given configuration. | |
virtual | ~Log_t () |
Releases links and resources (e.g. closes log file). | |
void | Push (const char *pszFmt,...) |
Logs a formated string ('printf' style). | |
virtual void | SetTgt (Log_t *pTgt) |
Sets a new target log (dumps history, redirects future records). | |
Protected Member Functions | |
Log_t () | |
Used only by 'LogImpl_t'. | |
virtual void | RegSrc (Log_t *pSrc, bool bReg=true) |
Links / unlinks log instances. | |
virtual void | PushLn (const char *pszText, bool bMsgBrk=false) |
Logs a text line. | |
Private Member Functions | |
Log_t (const Log_t &) | |
No copy. | |
Log_t & | operator= (const Log_t &) |
No assignment. | |
Private Attributes | |
Log_t * | m_pImpl |
The PIPML idiom is used. | |
Friends | |
class | LogImpl_t |
Log_t::Log_t | ( | unsigned int | fMode, | |
size_t | uHist = 1024 , |
|||
const char * | pszFile = "fs.log" | |||
) | [explicit] |
Initializes a new log instance using the given configuration.
fMode | Configuration flags (see Mode_e). | |
uHist | History depth (in combination with LOG_HIST). | |
pszFile | Filename of the log file (in combination with LOG_FILE). |
Definition at line 250 of file fsLog.cpp.
References FS_ASSERT_MSG, and m_pImpl.
Log_t::~Log_t | ( | ) | [virtual] |
fs::sys::Log_t::Log_t | ( | const Log_t & | ) | [private] |
No copy.
void Log_t::Push | ( | const char * | pszFmt, | |
... | ||||
) |
Logs a formated string ('printf' style).
Definition at line 273 of file fsLog.cpp.
References FS_ASSERT_MSG, m_pImpl, and PushLn().
Here is the call graph for this function:
void Log_t::PushLn | ( | const char * | pszText, | |
bool | bMsgBrk = false | |||
) | [protected, virtual] |
Logs a text line.
Reimplemented in fs::sys::LogImpl_t.
Definition at line 352 of file fsLog.cpp.
References FS_ASSERT_MSG, m_pImpl, and PushLn().
Here is the call graph for this function:
void Log_t::RegSrc | ( | Log_t * | pSrc, | |
bool | bReg = true | |||
) | [protected, virtual] |
Links / unlinks log instances.
Reimplemented in fs::sys::LogImpl_t.
Definition at line 366 of file fsLog.cpp.
References FS_ASSERT_MSG, m_pImpl, and RegSrc().
Here is the call graph for this function:
void Log_t::SetTgt | ( | Log_t * | pTgt | ) | [virtual] |
Sets a new target log (dumps history, redirects future records).
pTgt | A new log target or 0 to reset current link. |
Reimplemented in fs::sys::LogImpl_t.
Definition at line 360 of file fsLog.cpp.
References FS_ASSERT_MSG, m_pImpl, and SetTgt().
Here is the call graph for this function:
Log_t* fs::sys::Log_t::m_pImpl [private] |