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