fs/sys/fsLog.h

Go to the documentation of this file.
00001 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
00002 /*                          _______      ______    ______          __      */
00003 /*  ~ ~ ~ ~ ~ ~ ~ ~ ~ ~    / ____(_)___ / ___ /)  / ____/___  ____/ /__    */
00004 /*       [fsLog]          / /_  / / __ \\__ \|/  / /   / __ \/ __  / _ \   */
00005 /*       rev.  12        / __/ / / /_/ /__/ /   / /___/ /_/ / /_/ /  __/   */
00006 /*    29th Jan 2007     /_/   /_/ ,___/____/    \____/\____/\__,_/\___/    */
00007 /*     [x] stable              /_/ (c) 2004-7 Filip STOKLAS (FipS)         */
00008 /*  ~ ~ ~ ~ ~ ~ ~ ~ ~ ~       http://HOLE.4FipS.com/fips_code.php          */
00009 /*                                                                         */
00010 /* This code is free for personal and commercial use. You may redistribute */
00011 /* it by any means. If you use the code for your own projects please give  */
00012 /* me credit. Please send a bug report. Don't alter or remove this header! */
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 //--- EXTERNAL CONFIGURATION >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
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 }} // namespace fs::sys
00134 //---------------------------------------------------------------------------
00135 #endif // FS_SYS_FSLOG_H

FipS' Code (Thu Feb 15 22:43:35 2007) - (c) Filip STOKLAS (FipS) - [ www ] [ Guest Book ]