00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef FS_SYS_FSLOG_H
00015 #define FS_SYS_FSLOG_H
00016
00017 #if defined(FS_INCLUDE_USERDEFS) // inject user definition file on request
00018 # include <fs/fsUserDefs.h>
00019 #endif
00020
00021
00022
00023 #if !defined(FS_LOG_USERDEFS) // define to overwrite default definitions
00025
00028 # define FS_LOG_ENABLE_MODLOG
00030 # define FS_LOG_MODLOG_MODE fs::sys::Log_t::LOG_HIST
00032 # define FS_LOG_MODLOG_HIST 1024
00034 # define FS_LOG_MODLOG_FILE "fs.log"
00035 # if !defined(NDEBUG)
00037 # define FS_LOG_ENABLE_DEBUG
00038 # endif
00039 #endif
00040
00041
00042
00043 namespace fs { namespace sys {
00044
00046
00075
00076 class Log_t
00077 {
00078 public:
00079
00081 enum Mode_e
00082 {
00083 LOG_HIST = 0x00000001,
00084 LOG_FILE = 0x00000002,
00085 LOG_STDOUT = 0x00000004,
00086 LOG_DBGOUT = 0x00000008,
00087 LOG_RTMBRK = 0x00000010
00088 };
00089
00091 explicit Log_t(unsigned int fMode, size_t uHist = 1024,
00092 const char *pszFile = "fs.log");
00094 virtual ~Log_t();
00095
00097 void Push(const char *pszFmt, ...);
00099 virtual void SetTgt(Log_t *pTgt);
00100
00101 protected:
00102
00103 friend class LogImpl_t;
00104 Log_t();
00105
00107 virtual void RegSrc(Log_t *pSrc, bool bReg = true);
00109 virtual void PushLn(const char *pszText, bool bMsgBrk = false);
00110
00111 private:
00112
00113 Log_t(const Log_t &);
00114 Log_t & operator = (const Log_t &);
00115
00116 Log_t *m_pImpl;
00117 };
00118
00119 #if defined (FS_LOG_ENABLE_MODLOG)
00121 Log_t & ModLog();
00122 #endif
00123
00124 #if defined(FS_LOG_ENABLE_MODLOG)
00125 # define FS_LOG fs::sys::ModLog().Push
00126 # if defined(FS_LOG_ENABLE_DEBUG)
00127 # define FS_LOG_DBG FS_LOG
00128 # else
00129 # define FS_LOG_DBG 1 ? ((void)0) : FS_LOG
00130 # endif
00131 #endif
00132
00133 }}
00134
00135 #endif // FS_SYS_FSLOG_H