63static std::unique_ptr<const std::map<TMVA::EMsgType, std::string> > 
gOwnTypeMap;
 
   64static std::unique_ptr<const std::map<TMVA::EMsgType, std::string> > 
gOwnColorMap;
 
   73   : fObjSource ( source ),
 
   86     fStrSource ( source ),
 
   98     fStrSource ( 
"Unknown" ),
 
  110     std::ostringstream(),
 
  130   if (&parent != 
this) {
 
  145   std::string source_name;
 
  146   if (fActiveType == kHEADER)
 
  148       source_name = fStrSource;
 
  150   if (fActiveType == kWARNING)
 
  152       source_name =
"<WARNING>";
 
  154   if (source_name.size() > fgMaxSourceSize) {
 
  155      source_name = source_name.substr( 0, fgMaxSourceSize - 3 );
 
  156      source_name += 
"...";
 
  167   return static_cast<UInt_t>(fgMaxSourceSize);
 
  175   std::string source_name = GetFormattedSource();
 
  176   if (source_name.size() < fgMaxSourceSize)
 
  177      for (std::string::size_type i=source_name.size(); i<fgMaxSourceSize; i++) source_name.push_back( 
' ' );
 
  179   return fgPrefix + source_name + fgSuffix;
 
  188   std::string source_name = GetFormattedSource();
 
  190   std::string message = this->str();
 
  191   std::string::size_type previous_pos = 0, current_pos = 0;
 
  195      current_pos = message.find( 
'\n', previous_pos );
 
  196      std::string 
line = message.substr( previous_pos, current_pos - previous_pos );
 
  198      std::ostringstream message_to_send;
 
  200      message_to_send.setf( std::ios::adjustfield, std::ios::left );
 
  201      message_to_send.width( fgMaxSourceSize );
 
  202      message_to_send << source_name << fgSuffix << 
line;
 
  203      std::string msg = message_to_send.str();
 
  204      this->WriteMsg( fActiveType, msg );
 
  206      if (current_pos == message.npos) 
break;
 
  207      previous_pos = current_pos + 1;
 
  222  if ( (
type < fMinType || fgInhibitOutput) && 
type!=kFATAL ) 
return; 
 
  224  std::map<EMsgType, std::string>::const_iterator stype;
 
  226  if ((stype = fgTypeMap.load()->find( 
type )) != fgTypeMap.load()->end()) {
 
  230   if (
type == kHEADER || 
type ==kWARNING)
 
  231     std::cout << fgPrefix << 
line << std::endl;
 
  232   else if (
type == kINFO || 
type == kVERBOSE)
 
  234     std::cout << 
line << std::endl;
 
  237     std::cout << fgColorMap.load()->find( 
type )->second << 
"<" << stype->second << 
">" << 
line << 
"\033[0m" << std::endl;
 
  242   if (
type == kINFO) std::cout << fgPrefix << 
line << std::endl;
 
  243   else               std::cout << fgPrefix << 
"<" << stype->second << 
"> " << 
line << std::endl;
 
  249   if (
type == kFATAL) {
 
  250      std::cout << 
"***> abort program execution" << std::endl;
 
  251      throw std::runtime_error(
"FATAL error");
 
  273      std::map<TMVA::EMsgType, std::string>*tmp  = 
new std::map<TMVA::EMsgType, std::string>();
 
  275      (*tmp)[kVERBOSE]  = std::string(
"VERBOSE");
 
  276      (*tmp)[kDEBUG]    = std::string(
"DEBUG");
 
  277      (*tmp)[kINFO]     = std::string(
"INFO");
 
  278      (*tmp)[kWARNING]  = std::string(
"WARNING");
 
  279      (*tmp)[kERROR]    = std::string(
"ERROR");
 
  280      (*tmp)[kFATAL]    = std::string(
"FATAL");
 
  281      (*tmp)[kSILENT]   = std::string(
"SILENT");
 
  282      (*tmp)[kHEADER]   = std::string(
"HEADER");
 
  283      const std::map<TMVA::EMsgType, std::string>* expected=0;
 
  284      if(fgTypeMap.compare_exchange_strong(expected,tmp)) {
 
  294      std::map<TMVA::EMsgType, std::string>*tmp  = 
new std::map<TMVA::EMsgType, std::string>();
 
  296      (*tmp)[kVERBOSE] = std::string(
"");
 
  297      (*tmp)[kDEBUG]   = std::string(
"\033[34m");
 
  298      (*tmp)[kINFO]    = std::string(
"");
 
  299      (*tmp)[kWARNING] = std::string(
"\033[1;31m");
 
  300      (*tmp)[kERROR]   = std::string(
"\033[31m");
 
  301      (*tmp)[kFATAL]   = std::string(
"\033[37;41;1m");
 
  302      (*tmp)[kSILENT]  = std::string(
"\033[30m");
 
  304      const std::map<TMVA::EMsgType, std::string>* expected=0;
 
  305      if(fgColorMap.compare_exchange_strong(expected,tmp)) {
 
static std::unique_ptr< const std::map< TMVA::EMsgType, std::string > > gOwnTypeMap
 
static std::unique_ptr< const std::map< TMVA::EMsgType, std::string > > gOwnColorMap
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
 
ostringstream derivative to redirect and format output
 
static const UInt_t fgMaxSourceSize
maximum length of source name
 
static const std::string fgPrefix
the prefix of the source name
 
MsgLogger(const TObject *source, EMsgType minType=kINFO)
constructor
 
MsgLogger & operator=(const MsgLogger &parent)
assignment operator
 
std::string GetPrintedSource() const
the full logger prefix
 
std::string fStrSource
alternative string source
 
static std::atomic< const std::map< EMsgType, std::string > * > fgColorMap
matches output types with terminal colors
 
static UInt_t GetMaxSourceSize()
returns the maximum source size
 
static void InhibitOutput()
 
const TObject * fObjSource
the source TObject (used for name)
 
static const std::string fgSuffix
suffix following source name
 
static void EnableOutput()
 
EMsgType fMinType
minimum type for output
 
static std::atomic< const std::map< EMsgType, std::string > * > fgTypeMap
matches output types with strings
 
std::string GetFormattedSource() const
make sure the source name is no longer than fgMaxSourceSize:
 
void InitMaps()
Create the message type and color maps.
 
EMsgType fActiveType
active type
 
void WriteMsg(EMsgType type, const std::string &line) const
putting the output string, the message type, and the color switcher together into a single string
 
static MsgLogger & Endmsg(MsgLogger &logger)
end line
 
static std::atomic< Bool_t > fgInhibitOutput
flag to suppress all output
 
void Send()
activates the logger writer
 
Mother of all ROOT objects.