00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #ifndef LOGS_H
00046 #define LOGS_H
00047
00048 #include "msdefs.h"
00049
00050 namespace ssobjects
00051 {
00052
00053
00054 #define LOG ssobjects::logs::logln
00055
00056 #ifdef DEBUG
00057 #define ENABLELOG ssobjects::logs::enable
00058 #define INITLOG ssobjects::logs::init
00059 #define DLOG ssobjects::logs::logln
00060 #define DUMP ssobjects::logs::dump
00061 #define FUNCLOG ssobjects::logs func
00062 #else
00063 #define DLOG 1 ? (void)0 : ssobjects::logs::log
00064 #define FUNCLOG(x)
00065 #define INITLOG(x)
00066 #define ENABLELOG 1 ? (void)0 : ssobjects::logs::enable
00067 #define DUMP 1 ? (void)0 : ssobjects::logs::dump
00068 #endif
00069
00070 class logs
00071 {
00072 public:
00073 enum {L_FILE=1,L_CONSOLE=2,L_DEFAULT=3,L_NONE=0,L_ALL=0xFFFFFFFF};
00074 logs(const char *pFuncName);
00075 ~logs();
00076
00077 public:
00078 static void log(const char* fmt,...);
00079 static void logln(const char* fmt,...);
00080 static void dump(void* pMemory,DWORD dwNumBytes);
00081 static void init(const char* pszLogFileName);
00082 static void deinit();
00083 static void enable(bool bEnable=true);
00084 static void set(unsigned nSet,unsigned nReset=0);
00085
00086 enum{max_funcs=100,max_func_len=80};
00087
00088 public:
00089 static bool m_bActive;
00090 static unsigned m_nFlags;
00091 static bool m_bInited;
00092
00093 private:
00094 static bool isPrintable(int c);
00095 static unsigned m_nTail;
00096 static char *m_pszFileName;
00097 static char m_szFuncName[max_funcs][max_func_len];
00098 };
00099
00100 };
00101
00102 #endif