30 #ifndef ROOT_TMVA_MsgLogger
31 #define ROOT_TMVA_MsgLogger
46 #if __cplusplus > 199711L
59 class MsgLogger :
public std::ostringstream,
public TObject {
63 MsgLogger(
const TObject* source, EMsgType minType = kINFO );
64 MsgLogger(
const std::string& source, EMsgType minType = kINFO );
65 MsgLogger( EMsgType minType = kINFO );
66 MsgLogger(
const MsgLogger& parent );
70 void SetSource (
const std::string& source ) { fStrSource = source; }
71 EMsgType GetMinType()
const {
return fMinType; }
72 void SetMinType( EMsgType minType ) { fMinType = minType; }
73 std::string GetSource()
const {
return fStrSource; }
74 std::string GetPrintedSource()
const;
75 std::string GetFormattedSource()
const;
77 static UInt_t GetMaxSourceSize() {
return static_cast<UInt_t
>(fgMaxSourceSize); }
80 MsgLogger& operator= (
const MsgLogger& parent );
83 static MsgLogger& Endmsg( MsgLogger& logger );
86 MsgLogger& operator<< ( MsgLogger& ( *_f )( MsgLogger& ) );
87 MsgLogger& operator<< ( std::ostream& ( *_f )( std::ostream& ) );
88 MsgLogger& operator<< ( std::ios& ( *_f )( std::ios& ) );
91 MsgLogger& operator<< ( EMsgType type );
94 template <
class T> MsgLogger& operator<< ( T arg ) {
95 *(std::ostringstream*)
this << arg;
100 static void InhibitOutput();
101 static void EnableOutput();
108 void WriteMsg( EMsgType type,
const std::string& line )
const;
110 const TObject* fObjSource;
111 std::string fStrSource;
112 static const std::string fgPrefix;
113 static const std::string fgSuffix;
114 EMsgType fActiveType;
115 static const UInt_t fgMaxSourceSize;
116 #if __cplusplus > 199711L
117 static std::atomic<Bool_t> fgOutputSupressed;
118 static std::atomic<Bool_t> fgInhibitOutput;
120 static std::atomic<const std::map<EMsgType, std::string>*> fgTypeMap;
121 static std::atomic<const std::map<EMsgType, std::string>*> fgColorMap;
123 static Bool_t fgOutputSupressed;
124 static Bool_t fgInhibitOutput;
126 static const std::map<EMsgType, std::string>* fgTypeMap;
127 static const std::map<EMsgType, std::string>* fgColorMap;
131 ClassDef(MsgLogger,0)
134 inline MsgLogger& MsgLogger::operator<< ( MsgLogger& (*_f)( MsgLogger& ) )
139 inline MsgLogger& MsgLogger::operator<< ( std::ostream& (*_f)( std::ostream& ) )
145 inline MsgLogger& MsgLogger::operator<< ( std::ios& ( *_f )( std::ios& ) )
151 inline MsgLogger& MsgLogger::operator<< ( EMsgType type )
158 inline MsgLogger& Endl(MsgLogger& ml) {
return MsgLogger::Endmsg(ml); }
162 #endif // TMVA_MsgLogger