Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
MessageSvc.cpp
Go to the documentation of this file.
1 #ifdef _WIN32
2 // Avoid conflicts between windows and the message service.
3 # define NOMSG
4 # define NOGDI
5 #endif
6 
7 #include "MessageSvc.h"
9 #include "GaudiKernel/Kernel.h"
10 #include "GaudiKernel/Message.h"
11 #include "GaudiKernel/StatusCode.h"
12 #include "GaudiKernel/System.h"
13 
14 #include <fstream>
15 #include <iostream>
16 #include <sstream>
17 
18 namespace {
19 
20  // erase_if functions for containers which do NOT invalidate iterators
21  // after the erase point, eg.std::{unordered_}{,multi}map, std::{forward_,}list.
22  // To be explicit: this does NOT work with std::vector.
23 
24  // TODO: replace with std::experimental::erase_if (Libraries Fundamental TS v2)
25 
26  template <typename Container, typename Iterator, typename Predicate>
27  void erase_if( Container& c, Iterator first, Iterator last, Predicate pred ) {
28  while ( first != last ) {
29  if ( pred( *first ) )
30  first = c.erase( first );
31  else
32  ++first;
33  }
34  }
35 
36  template <typename Container, typename Predicate>
37  void erase_if( Container& c, Predicate pred ) {
38  return erase_if( c, std::begin( c ), std::end( c ), std::forward<Predicate>( pred ) );
39  }
40 
41  template <typename Container, typename Iterator, typename Predicate>
42  void erase_if( Container& c, std::pair<Iterator, Iterator> range, Predicate pred ) {
43  return erase_if( c, std::move( range.first ), std::move( range.second ), std::forward<Predicate>( pred ) );
44  }
45 
46  std::string colTrans( const std::string& col, int offset ) {
47  int icol = 0;
48  if ( col == "black" )
49  icol = MSG::BLACK;
50  else if ( col == "red" )
51  icol = MSG::RED;
52  else if ( col == "green" )
53  icol = MSG::GREEN;
54  else if ( col == "yellow" )
55  icol = MSG::YELLOW;
56  else if ( col == "blue" )
57  icol = MSG::BLUE;
58  else if ( col == "purple" )
59  icol = MSG::PURPLE;
60  else if ( col == "cyan" )
61  icol = MSG::CYAN;
62  else if ( col == "white" )
63  icol = MSG::WHITE;
64  else
65  icol = 8;
66  return std::to_string( icol + offset );
67  }
68 } // namespace
69 
70 // Instantiation of a static factory class used by clients to create
71 // instances of this service
73 
74 static const std::string levelNames[MSG::NUM_LEVELS] = {"NIL", "VERBOSE", "DEBUG", "INFO",
75  "WARNING", "ERROR", "FATAL", "ALWAYS"};
76 
77 // Constructor
78 MessageSvc::MessageSvc( const std::string& name, ISvcLocator* svcloc ) : base_class( name, svcloc ) {
79 
80  m_outputLevel.declareUpdateHandler( [svcloc]( Gaudi::Details::PropertyBase& ) {
81  SmartIF<IAppMgrUI> app = svcloc;
82  if ( app ) app->outputLevelUpdate();
83  } );
84 
85 #ifndef NDEBUG
86  // initialize the MsgStream static flag.
88 #endif
89 
90  for ( int ic = 0; ic < MSG::NUM_LEVELS; ++ic ) {
91  m_logColors[ic].declareUpdateHandler( &MessageSvc::setupColors, this );
92  m_msgLimit[ic].declareUpdateHandler( &MessageSvc::setupLimits, this );
93  m_thresholdProp[ic].declareUpdateHandler( &MessageSvc::setupThreshold, this );
94  }
95 
96  m_logColors[MSG::FATAL].set( {"blue", "red"} );
97  m_logColors[MSG::ERROR].set( {"white", "red"} );
98  m_logColors[MSG::WARNING].set( {"yellow"} );
99 
101 }
102 
103 //#############################################################################
104 
108  if ( sc.isFailure() ) return sc;
109 
110 #ifdef _WIN32
111  m_color = false;
112 #endif
113 
114  // make sure the map of logged stream names is initialized
115  setupLogStreams();
116 
117  return StatusCode::SUCCESS;
118 }
119 
120 //#############################################################################
121 
125  return initialize();
126 }
127 
128 //#############################################################################
129 
131  const std::string& pname = prop.name();
132  int level;
133  if ( pname == "fatalColorCode" )
134  level = MSG::FATAL;
135  else if ( pname == "errorColorCode" )
136  level = MSG::ERROR;
137  else if ( pname == "warningColorCode" )
138  level = MSG::WARNING;
139  else if ( pname == "infoColorCode" )
140  level = MSG::INFO;
141  else if ( pname == "debugColorCode" )
142  level = MSG::DEBUG;
143  else if ( pname == "verboseColorCode" )
144  level = MSG::VERBOSE;
145  else if ( pname == "alwaysColorCode" )
146  level = MSG::ALWAYS;
147  else {
148  throw GaudiException( "ERROR: Unknown message color parameter: " + pname, name(), StatusCode::FAILURE );
149  }
150 
151  auto& code = m_logColorCodes[level];
152 
153  const auto& col_desc = m_logColors[level].value();
154 
155  if ( col_desc.size() == 1 ) {
156  const std::string& desc = col_desc[0];
157  if ( desc.empty() ) {
158  code = "";
159  } else if ( desc[0] == '[' ) {
160  code = "\033" + desc;
161  } else {
162  code = "\033[" + colTrans( desc, 90 ) + ";1m";
163  }
164  } else if ( col_desc.size() == 2 ) {
165  code = "\033[" + colTrans( col_desc[0], 90 ) + ";" + colTrans( col_desc[1], 100 ) + ";1m";
166  } else { // empty desc: no color
167  code = "";
168  }
169 }
170 //#############################################################################
171 
173  // Just report problems in the settings of the limits and unknown limit parameters
174  if ( prop.name() == "alwaysLimit" ) {
175  Gaudi::Property<int>* p = dynamic_cast<Gaudi::Property<int>*>( &prop );
176  if ( p && p->value() != 0 ) {
177  std::cout << "MessageSvc ERROR: cannot suppress ALWAYS messages" << std::endl;
178  p->setValue( 0 );
179  }
180  } else if ( prop.name() == "defaultLimit" ) {
181  for ( int i = MSG::VERBOSE; i < MSG::NUM_LEVELS; ++i ) {
182  if ( i != MSG::ALWAYS ) { m_msgLimit[i] = m_msgLimit[MSG::NIL].value(); }
183  }
184  } else if ( prop.name() != "fatalLimit" && prop.name() != "errorLimit" && prop.name() != "warningLimit" &&
185  prop.name() == "infoLimit" && prop.name() == "debugLimit" && prop.name() == "verboseLimit" ) {
186  std::cout << "MessageSvc ERROR: Unknown message limit parameter: " << prop.name() << std::endl;
187  return;
188  }
189 }
190 //#############################################################################
191 
193 
194  static const std::array<std::pair<const char*, MSG::Level>, 7> tbl{{{"setFatal", MSG::FATAL},
195  {"setError", MSG::ERROR},
196  {"setWarning", MSG::WARNING},
197  {"setInfo", MSG::INFO},
198  {"setDebug", MSG::DEBUG},
199  {"setVerbose", MSG::VERBOSE},
200  {"setAlways", MSG::ALWAYS}}};
201 
202  auto i = std::find_if( std::begin( tbl ), std::end( tbl ),
203  [&]( const std::pair<const char*, MSG::Level>& t ) { return prop.name() == t.first; } );
204  if ( i == std::end( tbl ) ) {
205  std::cerr << "MessageSvc ERROR: Unknown message threshold parameter: " << prop.name() << std::endl;
206  return;
207  }
208  int ic = i->second;
209 
211  if ( !sap ) {
212  std::cerr << "could not dcast " << prop.name()
213  << " to a Gaudi::Property<std::vector<std::string>> (which it should be!)" << std::endl;
214  } else {
215  for ( auto& i : sap->value() ) setOutputLevel( i, ic );
216  }
217 }
218 
219 //#############################################################################
220 
221 #ifdef NDEBUG
223 #else
225  if ( prop.name() == "countInactive" ) {
226  Gaudi::Property<bool>* p = dynamic_cast<Gaudi::Property<bool>*>( &prop );
227  if ( p ) MsgStream::enableCountInactive( p->value() );
228  }
229 }
230 #endif
231 
232 //#############################################################################
235 
236  m_suppress = false;
237 
238  {
240 
241  if ( m_stats ) {
242  os << "Summarizing all message counts" << std::endl;
243  } else {
244  os << "Listing sources of suppressed message: " << std::endl;
245  }
246 
247  os << "=====================================================" << std::endl;
248  os << " Message Source | Level | Count" << std::endl;
249  os << "-----------------------------+---------+-------------" << std::endl;
250 
251  bool found( false );
252 
253  for ( auto itr = m_sourceMap.begin(); itr != m_sourceMap.end(); ++itr ) {
254  for ( unsigned int ic = 0; ic < MSG::NUM_LEVELS; ++ic ) {
255  if ( ( itr->second.msg[ic] >= m_msgLimit[ic] && m_msgLimit[ic] != 0 ) ||
256  ( m_stats && itr->second.msg[ic] > 0 && ic >= m_statLevel.value() ) ) {
257  os << " ";
258  os.width( 28 );
259  os.setf( std::ios_base::left, std::ios_base::adjustfield );
260  os << itr->first;
261  os << "|";
262 
263  os.width( 8 );
264  os.setf( std::ios_base::right, std::ios_base::adjustfield );
265  os << levelNames[ic];
266  os << " |";
267 
268  os.width( 9 );
269  os << itr->second.msg[ic];
270  os << std::endl;
271 
272  found = true;
273  }
274  }
275  }
276  os << "=====================================================" << std::endl;
277  if ( found || m_stats ) std::cout << os.str();
278  }
279 
280 #ifndef NDEBUG
281  if ( m_inactCount.value() ) {
282 
284  os << "Listing sources of Unprotected and Unseen messages\n";
285 
286  bool found( false );
287 
288  unsigned int ml( 0 );
289  for ( const auto& itr : m_inactiveMap ) {
290  for ( unsigned int ic = 0; ic < MSG::NUM_LEVELS; ++ic ) {
291  if ( itr.second.msg[ic] != 0 && itr.first.length() > ml ) { ml = itr.first.length(); }
292  }
293  }
294 
295  for ( unsigned int i = 0; i < ml + 25; ++i ) os << "=";
296 
297  os << std::endl << " ";
298  os.width( ml + 2 );
299  os.setf( std::ios_base::left, std::ios_base::adjustfield );
300  os << "Message Source";
301  os.width( 1 );
302  os << "| Level | Count" << std::endl;
303 
304  for ( unsigned int i = 0; i < ml + 3; ++i ) os << "-";
305  os << "+---------+-----------" << std::endl;
306 
307  for ( auto itr = m_inactiveMap.begin(); itr != m_inactiveMap.end(); ++itr ) {
308  for ( unsigned int ic = 0; ic < MSG::NUM_LEVELS; ++ic ) {
309  if ( itr->second.msg[ic] != 0 ) {
310  os << " ";
311  os.width( ml + 2 );
312  os.setf( std::ios_base::left, std::ios_base::adjustfield );
313  os << itr->first;
314 
315  os << "|";
316 
317  os.width( 8 );
318  os.setf( std::ios_base::right, std::ios_base::adjustfield );
319  os << levelNames[ic];
320 
321  os << " |";
322 
323  os.width( 9 );
324  os << itr->second.msg[ic];
325 
326  os << std::endl;
327 
328  found = true;
329  }
330  }
331  }
332  for ( unsigned int i = 0; i < ml + 25; ++i ) os << "=";
333  os << std::endl;
334 
335  if ( found ) std::cout << os.str();
336  }
337 #endif
338 
339  return StatusCode::SUCCESS;
340 }
341 
342 //#############################################################################
343 // ---------------------------------------------------------------------------
344 // Routine: reportMessage
345 // Purpose: dispatches a message to the relevant streams.
346 // ---------------------------------------------------------------------------
347 //
350  i_reportMessage( msg, outputLevel );
351 }
352 
354  int key = msg.getType();
355 
356  ++m_msgCount[key];
357 
358  const Message* cmsg = &msg;
359 
360  // processing logged streams
361  if ( !m_loggedStreams.empty() ) {
362  auto iLog = m_loggedStreams.find( msg.getSource() );
363  if ( m_loggedStreams.end() != iLog ) { ( *iLog->second ) << *cmsg << std::endl; }
364  }
365 
366  if ( m_suppress.value() || m_stats.value() ) {
367 
368  // Increase the counter of 'key' type of messages for the source and
369  // get the new value.
370  const int nmsg = ++( m_sourceMap[msg.getSource()].msg[key] );
371 
372  if ( m_suppress.value() && m_msgLimit[key] != 0 ) {
373  if ( nmsg > m_msgLimit[key] ) return;
374  if ( nmsg == m_msgLimit[key] ) {
375  std::string txt = levelNames[key] + " message limit (" + std::to_string( m_msgLimit[key].value() ) +
376  ") reached for " + msg.getSource() + ". Suppressing further output.";
377  cmsg = new Message( msg.getSource(), MSG::WARNING, std::move( txt ) );
378  cmsg->setFormat( msg.getFormat() );
379  }
380  }
381  }
382 
383  auto range = m_streamMap.equal_range( key );
384  if ( range.first != m_streamMap.end() ) {
385  std::for_each( range.first, range.second,
386  [&]( StreamMap::const_reference sm ) { *sm.second.second << *cmsg << std::endl; } );
387  } else if ( key >= outputLevel ) {
388  msg.setFormat( m_defaultFormat );
390  if ( !m_color ) {
391  ( *m_defaultStream ) << *cmsg << std::endl << std::flush;
392  } else {
393  ( *m_defaultStream ) << m_logColorCodes[key] << *cmsg << "\033[m" << std::endl << std::flush;
394  }
395  }
396 
397  if ( cmsg != &msg ) { delete cmsg; }
398 }
399 
400 //#############################################################################
401 // ---------------------------------------------------------------------------
402 // Routine: reportMessage
403 // Purpose: dispatches a message to the relevant streams.
404 // ---------------------------------------------------------------------------
405 //
407 
408 //#############################################################################
409 // ---------------------------------------------------------------------------
410 // Routine: reportMessage
411 // Purpose: dispatches a message to the relevant streams.
412 // ---------------------------------------------------------------------------
413 //
414 void MessageSvc::reportMessage( const char* source, int type, const char* message ) {
415  reportMessage( Message{source, type, message} );
416 }
417 
418 //#############################################################################
419 // ---------------------------------------------------------------------------
420 // Routine: reportMessage
421 // Purpose: dispatches a message to the relevant streams.
422 // ---------------------------------------------------------------------------
423 //
424 void MessageSvc::reportMessage( const std::string& source, int type, const std::string& message ) {
425  reportMessage( Message{source, type, message} );
426 }
427 
428 //#############################################################################
429 // ---------------------------------------------------------------------------
430 // Routine: sendMessage
431 // Purpose: finds a message for a given status code and dispatches it.
432 // ---------------------------------------------------------------------------
433 //
434 void MessageSvc::reportMessage( const StatusCode& code, const std::string& source ) {
436  i_reportMessage( code, source );
437 }
438 
439 void MessageSvc::i_reportMessage( const StatusCode& code, const std::string& source ) {
440  int level = outputLevel( source );
441  auto report = [&]( Message mesg ) {
442  mesg.setSource( source );
443  Message stat_code( source, mesg.getType(), "Status Code " + std::to_string( code.getCode() ) );
444  i_reportMessage( std::move( stat_code ), level );
445  i_reportMessage( std::move( mesg ), level );
446  };
447 
448  auto range = m_messageMap.equal_range( code );
449  if ( range.first != m_messageMap.end() ) {
450  std::for_each( range.first, range.second, [&]( MessageMap::const_reference sm ) { report( sm.second ); } );
451  } else {
452  report( m_defaultMessage );
453  }
454 }
455 
456 //#############################################################################
457 // ---------------------------------------------------------------------------
458 // Routine: insertStream
459 // Purpose: inserts a stream for a message type.
460 // ---------------------------------------------------------------------------
461 //
462 
463 void MessageSvc::insertStream( int key, const std::string& name, std::ostream* stream ) {
464  m_streamMap.emplace( key, NamedStream( name, stream ) );
465 }
466 
467 //#############################################################################
468 // ---------------------------------------------------------------------------
469 // Routine: eraseStream
470 // Purpose: erases all the streams for all the message types.
471 // ---------------------------------------------------------------------------
472 //
473 
475 
476 //#############################################################################
477 // ---------------------------------------------------------------------------
478 // Routine: eraseStream
479 // Purpose: erases all the streams for a message type.
480 // ---------------------------------------------------------------------------
481 //
482 
483 void MessageSvc::eraseStream( int message_type ) { m_streamMap.erase( message_type ); }
484 
485 //#############################################################################
486 // ---------------------------------------------------------------------------
487 // Routine: eraseStream
488 // Purpose: erases one stream for a message type.
489 // ---------------------------------------------------------------------------
490 //
491 
492 void MessageSvc::eraseStream( int key, std::ostream* stream ) {
493  if ( stream ) {
494  erase_if( m_streamMap, m_streamMap.equal_range( key ),
495  [&]( StreamMap::const_reference j ) { return j.second.second == stream; } );
496  }
497 }
498 
499 //#############################################################################
500 // ---------------------------------------------------------------------------
501 // Routine: eraseStream
502 // Purpose: erases one stream for all message types.
503 // ---------------------------------------------------------------------------
504 //
505 
507  if ( stream ) {
508  erase_if( m_streamMap, [&]( StreamMap::const_reference j ) { return j.second.second == stream; } );
509  }
510 }
511 
512 //#############################################################################
513 // ---------------------------------------------------------------------------
514 // Routine: insertMessage
515 // Purpose: inserts a message for a status code.
516 // ---------------------------------------------------------------------------
517 //
518 
519 void MessageSvc::insertMessage( const StatusCode& key, const Message& msg ) {
521  m_messageMap.emplace( key, msg );
522 }
523 
524 //#############################################################################
525 // ---------------------------------------------------------------------------
526 // Routine: eraseMessage
527 // Purpose: erases all the messages for all the status codes.
528 // ---------------------------------------------------------------------------
529 //
530 
534 }
535 
536 //#############################################################################
537 // ---------------------------------------------------------------------------
538 // Routine: eraseMessage
539 // Purpose: erases all the messages for a status code.
540 // ---------------------------------------------------------------------------
541 //
542 
545  m_messageMap.erase( key );
546 }
547 
548 //#############################################################################
549 // ---------------------------------------------------------------------------
550 // Routine: eraseMessage
551 // Purpose: erases one message for a status code.
552 // ---------------------------------------------------------------------------
553 //
554 
555 void MessageSvc::eraseMessage( const StatusCode& key, const Message& msg ) {
557 
558  erase_if( m_messageMap, m_messageMap.equal_range( key ),
559  [&]( MessageMap::const_reference j ) { return j.second == msg; } );
560 }
561 
562 // ---------------------------------------------------------------------------
564  // ---------------------------------------------------------------------------
565  return m_outputLevel;
566 }
567 
568 // ---------------------------------------------------------------------------
569 int MessageSvc::outputLevel( const std::string& source ) const {
570  // ---------------------------------------------------------------------------
572  auto it = m_thresholdMap.find( source );
573  return it != m_thresholdMap.end() ? it->second : m_outputLevel.value();
574 }
575 
576 // ---------------------------------------------------------------------------
577 void MessageSvc::setOutputLevel( int new_level ) {
578  // ---------------------------------------------------------------------------
579  m_outputLevel = new_level;
580 }
581 
582 // ---------------------------------------------------------------------------
583 void MessageSvc::setOutputLevel( const std::string& source, int level ) {
584  // ---------------------------------------------------------------------------
586 
587  // only write if we really have to...
588  auto i = m_thresholdMap.find( source );
589  if ( i == m_thresholdMap.end() ) {
590  m_thresholdMap[source] = level;
591  } else if ( i->second != level ) {
592  i->second = level;
593  }
594 }
595 
596 // ---------------------------------------------------------------------------
597 std::string MessageSvc::getLogColor( int logLevel ) const {
598  // ---------------------------------------------------------------------------
599  return ( logLevel < MSG::NUM_LEVELS ) ? m_logColorCodes[logLevel] : "";
600 }
601 
602 // ---------------------------------------------------------------------------
604 
605 // ---------------------------------------------------------------------------
607  ++( m_inactiveMap[source].msg[level] );
608 
611  std::cout << "== inactive message detected from " << source << " ==" << std::endl;
612  std::string t;
613  System::backTrace( t, 25, 0 );
614  std::cout << t << std::endl;
615  }
616 }
617 
618 // ---------------------------------------------------------------------------
620  // reset state
622 
623  for ( auto& iProp : m_loggedStreamsName ) {
624 
625  std::set<std::string> outFileNames;
626  for ( auto& jProp : m_loggedStreamsName ) {
627  if ( jProp.first != iProp.first ) { outFileNames.insert( jProp.second ); }
628  }
629  tee( iProp.first, iProp.second, outFileNames );
630 
631  } //> loop over property entries
632 }
633 
634 // ---------------------------------------------------------------------------
635 void MessageSvc::tee( const std::string& sourceName, const std::string& outFileName,
636  const std::set<std::string>& outFileNames ) {
637  const std::ios_base::openmode openMode = std::ios_base::out | std::ios_base::trunc;
638 
639  auto iStream = m_loggedStreams.find( sourceName );
640  if ( iStream != std::end( m_loggedStreams ) ) { m_loggedStreams.erase( iStream ); }
641 
642  // before creating a new ofstream, make sure there is no already existing
643  // one with the same file name...
644  for ( auto& iStream : m_loggedStreams ) {
645  if ( outFileNames.find( outFileName ) != outFileNames.end() ) {
646  m_loggedStreams[sourceName] = m_loggedStreams[iStream.first];
647  return;
648  }
649  }
650 
651  auto out = std::make_shared<std::ofstream>( outFileName, openMode );
652  if ( out->good() ) m_loggedStreams[sourceName] = std::move( out );
653 }
Gaudi::Property< int > m_outputLevel
Definition: Service.h:176
const std::string & getFormat() const
Get the format string.
Definition: Message.cpp:126
T setf(T...args)
StatusCode initialize() override
Definition: Service.cpp:60
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
T empty(T...args)
bool setValue(const ValueType &v)
Definition: Property.h:527
Define general base for Gaudi exception.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
Gaudi::StateMachine::State m_state
Service state.
Definition: Service.h:153
StreamMap m_streamMap
Stream map.
Definition: MessageSvc.h:178
Implementation of property with value of concrete type.
Definition: Property.h:352
std::string getLogColor(int logLevel) const override
Definition: MessageSvc.cpp:597
virtual void i_reportMessage(const Message &msg, int outputLevel)
Internal implementation of reportMessage(const Message&,int) without lock.
Definition: MessageSvc.cpp:353
void setupInactCount(Gaudi::Details::PropertyBase &prop)
Definition: MessageSvc.cpp:224
std::map< std::string, MsgAry > m_sourceMap
Definition: MessageSvc.h:192
const std::string name() const
property name
Definition: Property.h:36
Message m_defaultMessage
Default Message.
Definition: MessageSvc.h:177
std::map< std::string, MsgAry > m_inactiveMap
Definition: MessageSvc.h:192
T to_string(T...args)
T endl(T...args)
MessageMap m_messageMap
Message map.
Definition: MessageSvc.h:179
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
STL namespace.
void setupLogStreams()
Definition: MessageSvc.cpp:619
Gaudi::Property< std::string > m_defaultTimeFormat
Definition: MessageSvc.h:131
MessageSvc(const std::string &name, ISvcLocator *svcloc)
Definition: MessageSvc.cpp:78
T end(T...args)
std::recursive_mutex m_messageMapMutex
Mutex to synchronize multiple access to m_messageMap.
Definition: MessageSvc.h:212
int getType() const
Get the message type.
Definition: Message.cpp:62
StatusCode reinitialize() override
Reinitialize Service.
Definition: MessageSvc.cpp:123
void eraseMessage() override
Definition: MessageSvc.cpp:531
bool isFailure() const
Definition: StatusCode.h:130
Gaudi::Property< std::vector< std::string > > m_tracedInactiveSources
Definition: MessageSvc.h:167
GAUDI_API int backTrace(void **addresses, const int depth)
void setupColors(Gaudi::Details::PropertyBase &prop)
Definition: MessageSvc.cpp:130
virtual void outputLevelUpdate()=0
Function to call to update the outputLevel of the components (after a change in MessageSvc).
STL class.
void eraseStream() override
Definition: MessageSvc.cpp:474
#define DECLARE_COMPONENT(type)
void incrInactiveCount(MSG::Level level, const std::string &src) override
Definition: MessageSvc.cpp:606
std::map< std::string, std::shared_ptr< std::ostream > > m_loggedStreams
Definition: MessageSvc.h:196
Gaudi::Property< bool > m_inactCount
Definition: MessageSvc.h:165
std::array< Gaudi::Property< std::vector< std::string > >, MSG::NUM_LEVELS > m_logColors
Definition: MessageSvc.h:146
Gaudi::Property< unsigned int > m_statLevel
Definition: MessageSvc.h:133
void setOutputLevel(int new_level) override
Definition: MessageSvc.cpp:577
StatusCode initialize() override
Initialize Service.
Definition: MessageSvc.cpp:106
ThresholdMap m_thresholdMap
Output level threshold map.
Definition: MessageSvc.h:180
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
std::pair< std::string, std::ostream * > NamedStream
Definition: MessageSvc.h:32
T erase(T...args)
void reportMessage(const Message &message) override
Definition: MessageSvc.cpp:406
T width(T...args)
Gaudi::Property< bool > m_color
Definition: MessageSvc.h:144
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
Gaudi::Property< std::string > m_defaultFormat
Definition: MessageSvc.h:130
std::recursive_mutex m_reportMutex
Mutex to synchronize multiple threads printing.
Definition: MessageSvc.h:209
T clear(T...args)
T move(T...args)
T flush(T...args)
T insert(T...args)
T find_if(T...args)
void setFormat(std::string msg) const
Set the format string.
Definition: Message.cpp:143
The Message class.
Definition: Message.h:17
StatusCode finalize() override
Finalize Service.
Definition: MessageSvc.cpp:234
boost::spirit::classic::position_iterator2< ForwardIterator > Iterator
Definition: Iterator.h:18
T begin(T...args)
Print levels enumeration.
Definition: IMessageSvc.h:14
void setTimeFormat(std::string timeFormat) const
Set the time format string.
Definition: Message.cpp:174
T emplace(T...args)
int outputLevel() const override
Definition: MessageSvc.cpp:563
STL class.
constexpr static const auto FAILURE
Definition: StatusCode.h:86
void setupLimits(Gaudi::Details::PropertyBase &prop)
Definition: MessageSvc.cpp:172
void setupThreshold(Gaudi::Details::PropertyBase &prop)
Definition: MessageSvc.cpp:192
Gaudi::Property< bool > m_stats
Definition: MessageSvc.h:132
std::string m_logColorCodes[MSG::NUM_LEVELS]
Definition: MessageSvc.h:182
const std::string & getSource() const
Get the message source.
Definition: Message.cpp:78
std::array< int, MSG::NUM_LEVELS > m_msgCount
Definition: MessageSvc.h:194
std::array< Gaudi::Property< std::vector< std::string > >, MSG::NUM_LEVELS > m_thresholdProp
Definition: MessageSvc.h:135
const ValueType & value() const
Backward compatibility (.
Definition: Property.h:525
code_t getCode() const
Retrieve value ("checks" the StatusCode)
Definition: StatusCode.h:137
T fill(T...args)
AttribStringParser::Iterator begin(const AttribStringParser &parser)
std::array< Gaudi::Property< int >, MSG::NUM_LEVELS > m_msgLimit
Definition: MessageSvc.h:155
void tee(const std::string &sourceName, const std::string &logFileName, const std::set< std::string > &declaredOutFileNames)
Definition: MessageSvc.cpp:635
T for_each(T...args)
Gaudi::Property< bool > m_suppress
Definition: MessageSvc.h:164
void insertMessage(const StatusCode &code, const Message &message) override
Definition: MessageSvc.cpp:519
Gaudi::Property< std::map< std::string, std::string > > m_loggedStreamsName
Definition: MessageSvc.h:173
static GAUDI_API bool enableCountInactive(bool value=true)
Enable/disable the count of inactive messages.
Definition: MsgStream.cpp:31
T equal_range(T...args)
void insertStream(int message_type, const std::string &name, std::ostream *stream) override
Definition: MessageSvc.cpp:463
int messageCount(MSG::Level logLevel) const override
Definition: MessageSvc.cpp:603
std::recursive_mutex m_thresholdMapMutex
Mutex to synchronize multiple access to m_thresholdMap (.
Definition: MessageSvc.h:216