#ifndef TLog_hh #define TLog_hh #include #include #include "TObject.h" #include "TNamed.h" #include "TString.h" /* globally available logging class * * usage: * gLog << << TLog::END; * gLog << TLog::INFO << << << TLog::END; * * gLog.SetLogLevel(TLog::WARNING); */ using namespace std; class TLog : public TObject{ private: ostringstream ostr; public : TLog(); TLog(const TLog& _tlog); ~TLog(); enum Level { VERBOSE, DEBUG, INFO, WARNING, ERROR, END }; void SetLogLevel(Level level){g_level = level;}; Level GetLogLevel(){return g_level;}; void SetLocalLogLevel(Level level){_level = level;}; Level GetLocalLogLevel(){return _level;}; TLog& operator<<(Level level); template TLog& operator<<(myNumber val){ if( g_level <= _level ) ostr << val; return *this; }; protected: private: Level g_level; // global Logging Level Level _level; // local Logging Level TString s_Level[(const int)END]; // Logging Level in StringArray ClassDef(TLog, 1) }; R__EXTERN TLog gLog; #endif