Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4Log.h

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #ifndef TGO4LOG_H
00017 #define TGO4LOG_H
00018 
00019 #include "TString.h"
00020 
00021 class TMutex;
00022 
00023 #define __MESSAGETEXTLENGTH__ 1024
00024 
00025 // define previous trace macro void
00026 #define TRACE(X) ;
00027 
00028 // optional definitions
00029 #define GO4MESSAGE( X ) TGo4Log::Message X;
00030 #define GO4INFO(X) TGo4Log::Info X ;
00031 #define GO4WARN(X) TGo4Log::Warn X ;
00032 #define GO4ERROR(X) TGo4Log::Error X ;
00033 
00041 class TGo4Log {
00042   public:
00043     static TGo4Log *Instance();
00044 
00046     static void SetIgnoreLevel(Int_t level);
00047 
00049     static Int_t GetIgnoreLevel();
00050 
00052     static void OutputEnable(Bool_t on=kTRUE);
00053 
00055     static Bool_t IsOutputEnabled();
00056 
00058     static void LogfileEnable(Bool_t on=kTRUE);
00059 
00061     static Bool_t IsLogfileEnabled();
00062 
00064     static void AutoEnable(Bool_t on=kTRUE);
00065 
00067     static Bool_t IsAutoEnabled();
00068 
00073     static void OpenLogfile(const char* name=0,
00074                             const char* headercomment=0,
00075                             Bool_t appendmode=kFALSE);
00076 
00078     static void CloseLogfile();
00079 
00081     static const char* GetLogname();
00082 
00089    static const char* Message(Int_t prio, const char* text,...);
00090 
00092    static void Debug(const char* text,...);
00093 
00095    static void Info(const char* text,...);
00096 
00098    static void Warn(const char* text,...);
00099 
00101    static void Error(const char* text,...);
00102 
00103 
00106     static void WriteLogfile(const char* text,
00107                              Bool_t withtime=kTRUE);
00108 
00110     static void set_trace_level(int) {}
00111 
00113     static void SetTracePriority(int) {}
00114 
00116     static void StartTracing(){Instance(); SetIgnoreLevel(0);}
00117 
00119     static void StopTracing(){Instance(); SetIgnoreLevel(1);}
00120 
00122     static const char* fgcLEFT; 
00123 
00125     static const char* fgcRIGHT;
00126 
00128     static const char* fgcDEBUG; 
00129 
00131     static const char* fgcINFO; 
00132 
00134     static const char* fgcWARN;
00135 
00137     static const char* fgcERR; 
00138 
00140     static const char* fgcDEFAULTLOG; 
00141 
00143     enum { fguMESLEN = __MESSAGETEXTLENGTH__ };
00144 
00145     virtual ~TGo4Log();
00146 
00147   private:
00148     TGo4Log();
00149 
00150     static TGo4Log* fgxInstance; 
00151 
00153     static TMutex* fgxMutex; 
00154 
00156     static Int_t fgiIgnoreLevel;  
00157 
00159     static Bool_t fgbOutputEnabled;   
00160 
00162     static Bool_t fgbLogfileEnabled;   
00163 
00165     static Bool_t fgbAutoMode;    
00166 
00168     static char fgcMessagetext[__MESSAGETEXTLENGTH__]; 
00169 
00171     static void* fgxLogfile;   
00172 
00174     static TString fgxLogName;    
00175 
00176   ClassDef(TGo4Log,1)
00177 };
00178 
00179 /* for backward compatibility in user code: */
00180 typedef TGo4Log TGo4Trace;
00181 
00182 #endif //TGO4LOG_H
00183 
00184 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:26 2008 for Go4-v3.04-1 by  doxygen 1.4.2