00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __UT_ErrorLog__
00020 #define __UT_ErrorLog__
00021
00022 #include "UT_API.h"
00023 #include <fstream.h>
00024 #include <time.h>
00025 #include "UT_SymbolTable.h"
00026 #include "UT_String.h"
00027 #include "UT_Lock.h"
00028
00029 class UT_Error;
00030
00031 class UT_API UT_ErrorLog
00032 {
00033 public:
00034 UT_ErrorLog();
00035 ~UT_ErrorLog();
00036
00037
00038
00039 void logError(UT_Error *);
00040
00041
00042
00043 const UT_String &getLogFileName() const
00044 { return myLogFileName; }
00045 void setLogFileName(const UT_String &name)
00046 {
00047 myLock.lockNap();
00048 myLogFileName.harden(name);
00049 myLogFileName.expandVariables();
00050 myLock.unlock();
00051 }
00052
00053 int getMinLevel() const
00054 { return myMinLevel; }
00055 void setMinLevel(const int level)
00056 { myMinLevel = level; }
00057
00058 bool getDoLogging() const
00059 { return myDoLogging; }
00060 void setDoLogging(bool log)
00061 { myDoLogging = log; }
00062
00063 void resetState()
00064 {
00065 myLock.lockNap();
00066 myErrorLogTimes.clear();
00067 myLock.unlock();
00068 }
00069
00070 protected:
00071
00072 private:
00073 int myMinLevel;
00074 UT_String myLogFileName;
00075 bool myDoLogging;
00076 UT_SymbolTable myErrorLogTimes;
00077 time_t myLastErrorTime;
00078 UT_Lock myLock;
00079 };
00080
00081 UT_API UT_ErrorLog *UTgetErrorLog();
00082
00083 #endif
00084