// $Id: EsafMsgDispatcher.hh,v 1.10 2005/09/22 16:41:03 naumov Exp $ // Author: M. Pallavicini Sep, 24 2004 /***************************************************************************** * ESAF: Euso Simulation and Analysis Framework * * * * Id: EsafMsgDispatcher * * Package: Base * * Coordinator: Marco.Pallavicini * * * *****************************************************************************/ #ifndef __ESAFMSGDISPATCHER_HH_ #define __ESAFMSGDISPATCHER_HH_ #include #include #include #include "euso.hh" #include "EsafConfigurable.hh" #include "EsafMsg.hh" //////////////////////////////////////////////////////////////////////////////// // // // EsafMsgDispatcher // // // // Dispatcher writes messages on screen and on logfile // // User can set a threshold on the severity of the messages to be displayed // // Severity can be also adjusted for specific classes for debugging purposes // // // //////////////////////////////////////////////////////////////////////////////// class EsafMsgDispatcher : public EsafConfigurable { public: virtual ~EsafMsgDispatcher(); void LoadConfig(); // load configuration from config files void OpenLog( const char* = 0 ); // open the log file inline void OpenLog( string name ) { OpenLog(name.c_str()); } static EsafMsgDispatcher* Get(); void Dispatch(const EsafMsg& , Bool_t endline = kTRUE, Bool_t ProcCount = kFALSE); inline void SetScreenSeverity( EsafMsg::MsgSeverity s ) { fDefaultScreenSeverity = s; } inline void SetLogSeverity( EsafMsg::MsgSeverity s ) { fDefaultLogSeverity = s; } inline EsafMsg::MsgSeverity GetScreenSeverity() { return fDefaultScreenSeverity; } inline EsafMsg::MsgSeverity GetLogSeverity() { return fDefaultLogSeverity; } EsafConfigClass(General,EsafMsgDispatcher) private: EsafMsgDispatcher(); static EsafMsgDispatcher* fMe; Int_t fHeaderLenght; Bool_t fIsScreenFlushed; Bool_t fIsLogFlushed; Bool_t fUseColors; static const char *const kEsc; static const char *const kReset; static const char *const kRed; static const char *const kGreen; static const char *const kYellow; static const char *const kBlue; static const char *const kUnderline; static const char *const kBlink; static const char *const kBright; static const char *const kDark; static const char *fgColors[]; EsafMsg::MsgSeverity fDefaultLogSeverity; // default severity level for log file EsafMsg::MsgSeverity fDefaultScreenSeverity; // default severity level for screen string fLogFileName; // log file name map fUserMap; // map of user defined target dependent severities ofstream fLogFile; ClassDef(EsafMsgDispatcher,0) }; #endif /* __ESAFMSGDISPATCHER_HH_ */