Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4Log/TGo4Log.h

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE 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 "TObject.h"
00020 #include "TString.h"
00021 #include <fstream.h>
00022 
00023 class TMutex;
00024 
00025 #define __MESSAGETEXTLENGTH__ 1024
00026 
00027 // define previous trace macro void
00028 #define TRACE(X) ;
00029 
00030 
00031 // optional definitions
00032 #define GO4MESSAGE( X ) TGo4Log::Message X;
00033 #define GO4INFO(X) TGo4Log::Info X ;
00034 #define GO4WARN(X) TGo4Log::Warn X ;
00035 #define GO4ERROR(X) TGo4Log::Error X ;
00036 
00044 class TGo4Log : public TObject {
00045   public:
00046     static TGo4Log *Instance();
00047 
00049     static void SetIgnoreLevel(Int_t level);
00050 
00052     static Int_t GetIgnoreLevel();
00053 
00055     static void OutputEnable(Bool_t on=kTRUE);
00056 
00058     static Bool_t IsOutputEnabled();
00059 
00061     static void LogfileEnable(Bool_t on=kTRUE);
00062 
00064     static Bool_t IsLogfileEnabled();
00065 
00067     static void AutoEnable(Bool_t on=kTRUE);
00068 
00070     static Bool_t IsAutoEnabled();
00071 
00076     static void OpenLogfile(const Text_t* name=0,
00077                             const Text_t* headercomment=0,
00078                             Bool_t appendmode=kFALSE);
00079 
00081     static void CloseLogfile();
00082 
00084     static const Text_t* GetLogname();
00085 
00094    static const Text_t* Message(Int_t prio, const Text_t* text,...);
00095 
00097    static void Debug(const Text_t* text,...);
00098 
00100    static void Info(const Text_t* text,...);
00101 
00103    static void Warn(const Text_t* text,...);
00104 
00106    static void Error(const Text_t* text,...);
00107 
00108 
00111     static void WriteLogfile(const Text_t* text,
00112                               Bool_t withtime=kTRUE);
00113 
00114 
00116     static void set_trace_level(int){;}
00117 
00119     static void SetTracePriority(int){;}
00120 
00122     static void StartTracing(){Instance(); SetIgnoreLevel(0);}
00123 
00125     static void StopTracing(){Instance(); SetIgnoreLevel(1);}
00126 
00128     static const Text_t fgcLEFT[]; 
00129 
00131     static const Text_t fgcRIGHT[];
00132 
00134     static const Text_t fgcDEBUG[]; 
00135 
00137     static const Text_t fgcINFO[]; 
00138 
00140     static const Text_t fgcWARN[];
00141 
00143     static const Text_t fgcERR[]; 
00144 
00146     static const Text_t fgcDEFAULTLOG[]; 
00147 
00149     static const UInt_t fguMESLEN;
00150 
00151     virtual ~TGo4Log();
00152 
00153   private:
00154     TGo4Log();
00155 
00156     static TGo4Log* fgxInstance; 
00157 
00159     static TMutex* fgxMutex; 
00160 
00162     static Int_t fgiIgnoreLevel;  
00163 
00165     static Bool_t fgbOutputEnabled;   
00166 
00168     static Bool_t fgbLogfileEnabled;   
00169 
00171     static Bool_t fgbAutoMode;    
00172 
00174     static Text_t fgcMessagetext[__MESSAGETEXTLENGTH__]; 
00175 
00177     static std::ofstream* fgxLogfile;   
00178 
00180     static TString fgxLogName;    
00181 
00182   ClassDef(TGo4Log,1)
00183 };
00184 
00185 /* for backward compatibility in user code: */
00186 typedef TGo4Log TGo4Trace;
00187 
00188 #endif //TGO4LOG_H
00189 
00190 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:56:04 2005 for Go4-v2.10-5 by doxygen1.2.15