31#define USE_COLORED_CONSOLE
95 if (
this != &parent) {
113 source_name +=
"...";
124 for (string::size_type i=source_name.size(); i<
m_maxSourceSize; i++) source_name.push_back(
' ' );
136 string message = this->
str();
137 string::size_type previous_pos = 0, current_pos = 0;
141 current_pos = message.find(
'\n', previous_pos );
142 string line = message.substr( previous_pos, current_pos - previous_pos );
144 ostringstream message_to_send;
146 message_to_send.setf( ios::adjustfield, ios::left );
148 message_to_send << source_name <<
m_suffix << line;
151 if (current_pos == message.npos)
break;
152 previous_pos = current_pos + 1;
165#ifdef USE_COLORED_CONSOLE
173 cout << col <<
m_prefix << line <<
"\033[0m" << endl;
176 <<
"<" << slevel->second <<
"> " << line <<
"\033[0m" << endl;
181 cout <<
m_prefix <<
"<" << slevel->second <<
"> " << line << endl;
185 if (mlevel ==
kFATAL) { cout <<
"***> abort program execution" << endl; std::abort(); }
201 std::map<TMsgLevel, std::string>::const_iterator it =
m_levelMap.begin();
202 for (; it !=
m_levelMap.end(); ++it)
if (ins == it->second)
return it->first;
205 TString line( Form(
"fatal error in <TMsgLogger::MapLevel> unknown output level: %s ==> abort", ins.Data() ) );
211 cout << col <<
m_prefix << line <<
"\033[0m" << endl;
static const string SUFFIX
static const string::size_type MAXIMUM_SOURCE_NAME_LENGTH
static const string PREFIX
static std::atomic< TMsgLevel > m_minLevel
TMsgLogger(const TObject *source, TMsgLevel minLevel=kINFO)
const std::string m_prefix
std::string GetFormattedSource() const
TMsgLevel MapLevel(const TString &instr) const
TMsgLogger & operator=(const TMsgLogger &parent)
void WriteMsg(TMsgLevel level, const std::string &line) const
static TMsgLogger & endmsg(TMsgLogger &logger)
std::map< TMsgLevel, std::string > m_levelMap
const std::string m_suffix
std::map< TMsgLevel, std::string > m_colorMap
const TObject * m_objSource
TMsgLevel GetMinLevel() const
std::string GetPrintedSource() const
const std::string::size_type m_maxSourceSize
static Root::TMsgLogger logger("iLumiCalc")