Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef TGO4LOG_H
00015 #define TGO4LOG_H
00016
00017 #include "TString.h"
00018 #include "RVersion.h"
00019
00020 class TMutex;
00021
00022 #define __MESSAGETEXTLENGTH__ 1024
00023
00024
00025 #define GO4TRACE(X) ;
00026
00027 #if ROOT_VERSION_CODE < ROOT_VERSION(5,99,0)
00028
00029 #define TRACE(X) ;
00030 #endif
00031
00032
00033 #define GO4MESSAGE( X ) TGo4Log::Message X;
00034 #define GO4INFO(X) TGo4Log::Info X ;
00035 #define GO4WARN(X) TGo4Log::Warn X ;
00036 #define GO4ERROR(X) TGo4Log::Error X ;
00037
00046 #ifdef __CINT__
00047
00048 class TGo4Log {
00049
00050 #else
00051
00052 #ifdef GO4_EXPORT
00053 #define TGO4LOG_CLASS_IMPORT __declspec(dllimport)
00054 #else
00055 #define TGO4LOG_CLASS_IMPORT
00056 #endif
00057
00058 class TGO4LOG_CLASS_IMPORT TGo4Log {
00059
00060 #endif
00061
00062 public:
00063 static TGo4Log *Instance();
00064
00068 static const char* GO4SYS();
00069
00072 static TString subGO4SYS(const char* subdir);
00073
00075 static void SetIgnoreLevel(Int_t level);
00076
00078 static Int_t GetIgnoreLevel();
00079
00081 static void OutputEnable(Bool_t on=kTRUE);
00082
00084 static Bool_t IsOutputEnabled();
00085
00087 static void LogfileEnable(Bool_t on=kTRUE);
00088
00090 static Bool_t IsLogfileEnabled();
00091
00093 static void AutoEnable(Bool_t on=kTRUE);
00094
00096 static Bool_t IsAutoEnabled();
00097
00102 static void OpenLogfile(const char* name=0,
00103 const char* headercomment=0,
00104 Bool_t appendmode=kFALSE);
00105
00107 static void CloseLogfile();
00108
00110 static const char* GetLogname();
00111
00118 static const char* Message(Int_t prio, const char* text,...);
00119
00121 static void Debug(const char* text,...);
00122
00124 static void Info(const char* text,...);
00125
00127 static void Warn(const char* text,...);
00128
00130 static void Error(const char* text,...);
00131
00134 static void WriteLogfile(const char* text, Bool_t withtime=kTRUE);
00135
00137 static void set_trace_level(int) {}
00138
00140 static void SetTracePriority(int) {}
00141
00143 static void StartTracing() { Instance(); SetIgnoreLevel(0); }
00144
00146 static void StopTracing() { Instance(); SetIgnoreLevel(1); }
00147
00149 static const char* GetDefaultLogname();
00150
00153 static const char* GetPrintfArg(Int_t type_id);
00154
00156 static const char* fgcLEFT;
00157
00159 static const char* fgcRIGHT;
00160
00162 static const char* fgcDEBUG;
00163
00165 static const char* fgcINFO;
00166
00168 static const char* fgcWARN;
00169
00171 static const char* fgcERR;
00172
00174 static const char* fgcDEFAULTLOG;
00175
00177 enum { fguMESLEN = __MESSAGETEXTLENGTH__ };
00178
00179 virtual ~TGo4Log();
00180
00181 static void SetSniffer(TNamed* sniff) { fgSniffer = sniff; }
00182
00183 private:
00184 TGo4Log();
00185
00186 static TGo4Log* fgxInstance;
00187
00189 static TMutex* fgxMutex;
00190
00192 static Int_t fgiIgnoreLevel;
00193
00195 static Bool_t fgbOutputEnabled;
00196
00198 static Bool_t fgbLogfileEnabled;
00199
00201 static Bool_t fgbAutoMode;
00202
00204 static char fgcMessagetext[__MESSAGETEXTLENGTH__];
00205
00207 static void* fgxLogfile;
00208
00210 static TString fgxLogName;
00211
00212 static TString fgsGO4SYS;
00213
00214 static TNamed* fgSniffer;
00215
00216 ClassDef(TGo4Log,1)
00217 };
00218
00219
00220 typedef TGo4Log TGo4Trace;
00221
00222 #endif //TGO4LOG_H