Main Page | Compound List | File List | Compound Members | File Members

Logger.h

Go to the documentation of this file.
00001 
00002 #ifndef LOGGER_H
00003 #define LOGGER_H
00004 
00005 #include <time.h>
00006 #include <stdio.h>
00007 #include <stdlib.h>
00008 
00097 class Logger
00098 {
00099  private:
00101   static const char *logFileName;
00103   static FILE *pFile;
00104 
00109   static bool debug;
00112   static bool mErrorFound;
00115   const char *className;
00116 
00117   Logger(const char *klassName);
00118   const char *getLocalTime(time_t aclock);
00119   const char *getTimeStamp();
00120   bool openLogFile();
00121 
00122  public:
00123   typedef enum {NOT_SET, DEBUG, ERROR, GARBAGE_TRACE} LogLevel;
00124   Logger() {}
00125   Logger(const char *logfileName, bool dbg );
00126   ~Logger() {};
00127   Logger(const Logger &rhs);
00128 
00129   Logger getLogger(const char *klassName);
00130   void log(const LogLevel level, 
00131            const char *methodName, 
00132            const char *message);
00133 
00134   static void setDebug();
00135   static bool errorFound();
00136 };
00137 
00142 inline
00143 Logger::Logger(const char *klassName) : className( klassName ) {}
00144 
00154 inline
00155 Logger::Logger(const char *logfileName, 
00156                bool dbg)
00157 {
00158   logFileName = logfileName;
00159   debug = dbg;
00160 }
00161 
00165 inline
00166 Logger::Logger(const Logger &rhs)
00167 {
00168   className = rhs.className;
00169 } // Logger constructor
00170 
00174 inline
00175 Logger Logger::getLogger(const char *klassName)
00176 {
00177   Logger l( klassName );
00178   return l;
00179 }
00180 
00181 extern Logger *pLogger;
00182 
00183 #endif

Generated on Sat Mar 27 13:07:37 2004 for Mail Filter by doxygen 1.3.3