36 template <
typename Container,
typename Iterator,
typename Predicate>
38 while ( first != last ) {
40 first =
c.erase( first );
46 template <
typename Container,
typename Predicate>
47 void erase_if( Container&
c, Predicate pred ) {
51 template <
typename Container,
typename Iterator,
typename Predicate>
60 else if ( col ==
"red" )
62 else if ( col ==
"green" )
64 else if ( col ==
"yellow" )
66 else if ( col ==
"blue" )
68 else if ( col ==
"purple" )
70 else if ( col ==
"cyan" )
72 else if ( col ==
"white" )
85 "WARNING",
"ERROR",
"FATAL",
"ALWAYS"};
146 if (
pname ==
"fatalColorCode" )
148 else if (
pname ==
"errorColorCode" )
150 else if (
pname ==
"warningColorCode" )
152 else if (
pname ==
"infoColorCode" )
154 else if (
pname ==
"debugColorCode" )
156 else if (
pname ==
"verboseColorCode" )
158 else if (
pname ==
"alwaysColorCode" )
168 if ( col_desc.size() == 1 ) {
170 if ( desc.
empty() ) {
172 }
else if ( desc[0] ==
'[' ) {
173 code =
"\033" + desc;
175 code =
"\033[" + colTrans( desc, 90 ) +
";1m";
177 }
else if ( col_desc.size() == 2 ) {
178 code =
"\033[" + colTrans( col_desc[0], 90 ) +
";" + colTrans( col_desc[1], 100 ) +
";1m";
187 if ( prop.
name() ==
"alwaysLimit" ) {
189 if ( p && p->
value() != 0 ) {
193 }
else if ( prop.
name() ==
"defaultLimit" ) {
197 }
else if ( prop.
name() !=
"fatalLimit" && prop.
name() !=
"errorLimit" && prop.
name() !=
"warningLimit" &&
198 prop.
name() ==
"infoLimit" && prop.
name() ==
"debugLimit" && prop.
name() ==
"verboseLimit" ) {
226 <<
" to a Gaudi::Property<std::vector<std::string>> (which it should be!)" <<
std::endl;
238 if ( prop.
name() ==
"countInactive" ) {
255 os <<
"Summarizing all message counts" <<
std::endl;
257 os <<
"Listing sources of suppressed message: " <<
std::endl;
260 os <<
"=====================================================" <<
std::endl;
261 os <<
" Message Source | Level | Count" <<
std::endl;
262 os <<
"-----------------------------+---------+-------------" <<
std::endl;
272 os.
setf( std::ios_base::left, std::ios_base::adjustfield );
277 os.
setf( std::ios_base::right, std::ios_base::adjustfield );
278 os << levelNames[ic];
282 os << itr->second.msg[ic];
289 os <<
"=====================================================" <<
std::endl;
297 os <<
"Listing sources of Unprotected and Unseen messages\n";
301 unsigned int ml( 0 );
304 if ( itr.second.msg[ic] != 0 && itr.first.length() > ml ) { ml = itr.first.length(); }
308 for (
unsigned int i = 0; i < ml + 25; ++i ) os <<
"=";
312 os.
setf( std::ios_base::left, std::ios_base::adjustfield );
313 os <<
"Message Source";
317 for (
unsigned int i = 0; i < ml + 3; ++i ) os <<
"-";
318 os <<
"+---------+-----------" <<
std::endl;
322 if ( itr->second.msg[ic] != 0 ) {
325 os.
setf( std::ios_base::left, std::ios_base::adjustfield );
331 os.
setf( std::ios_base::right, std::ios_base::adjustfield );
332 os << levelNames[ic];
337 os << itr->second.msg[ic];
345 for (
unsigned int i = 0; i < ml + 25; ++i ) os <<
"=";
367 int key =
msg.getType();
389 ") reached for " +
msg.getSource() +
". Suppressing further output.";
399 [&]( StreamMap::const_reference sm ) { *sm.second.second << *cmsg << std::endl; } );
410 if ( cmsg != &
msg ) {
delete cmsg; }
454 auto report = [&](
Message mesg ) {
455 mesg.setSource( source );
508 [&]( StreamMap::const_reference j ) {
return j.second.second == stream; } );
521 erase_if(
m_streamMap, [&]( StreamMap::const_reference j ) {
return j.second.second == stream; } );
572 [&]( MessageMap::const_reference j ) {
return j.second ==
msg; } );
604 }
else if ( i->second !=
level ) {
640 if ( jProp.first != iProp.first ) { outFileNames.
insert( jProp.second ); }
642 tee( iProp.first, iProp.second, outFileNames );
650 const std::ios_base::openmode openMode = std::ios_base::out | std::ios_base::trunc;
658 if ( outFileNames.
find( outFileName ) != outFileNames.
end() ) {
664 auto out = std::make_shared<std::ofstream>( outFileName, openMode );
Gaudi::Property< int > m_outputLevel
code_t getCode() const
Retrieve value ("checks" the StatusCode)
StatusCode initialize() override
bool setValue(const ValueType &v)
Define general base for Gaudi exception.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Gaudi::StateMachine::State m_state
Service state.
StreamMap m_streamMap
Stream map.
Implementation of property with value of concrete type.
virtual void i_reportMessage(const Message &msg, int outputLevel)
Internal implementation of reportMessage(const Message&,int) without lock.
void setupInactCount(Gaudi::Details::PropertyBase &prop)
std::map< std::string, MsgAry > m_sourceMap
Message m_defaultMessage
Default Message.
std::map< std::string, MsgAry > m_inactiveMap
MessageMap m_messageMap
Message map.
constexpr static const auto SUCCESS
Gaudi::Property< std::string > m_defaultTimeFormat
MessageSvc(const std::string &name, ISvcLocator *svcloc)
std::recursive_mutex m_messageMapMutex
Mutex to synchronize multiple access to m_messageMap.
const std::string name() const
property name
StatusCode reinitialize() override
Reinitialize Service.
void eraseMessage() override
Gaudi::Property< std::vector< std::string > > m_tracedInactiveSources
GAUDI_API int backTrace(void **addresses, const int depth)
void setupColors(Gaudi::Details::PropertyBase &prop)
void setFormat(std::string msg) const
Set the format string.
virtual void outputLevelUpdate()=0
Function to call to update the outputLevel of the components (after a change in MessageSvc).
void eraseStream() override
#define DECLARE_COMPONENT(type)
void incrInactiveCount(MSG::Level level, const std::string &src) override
std::map< std::string, std::shared_ptr< std::ostream > > m_loggedStreams
Gaudi::Property< bool > m_inactCount
const std::string & name() const override
Retrieve name of the service.
std::array< Gaudi::Property< std::vector< std::string > >, MSG::NUM_LEVELS > m_logColors
Gaudi::Property< unsigned int > m_statLevel
std::string getLogColor(int logLevel) const override
void setOutputLevel(int new_level) override
StatusCode initialize() override
Initialize Service.
ThresholdMap m_thresholdMap
Output level threshold map.
This class is used for returning status codes from appropriate routines.
const ValueType & value() const
Backward compatibility (.
std::pair< std::string, std::ostream * > NamedStream
void reportMessage(const Message &message) override
Gaudi::Property< bool > m_color
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Gaudi::Property< std::string > m_defaultFormat
std::recursive_mutex m_reportMutex
Mutex to synchronize multiple threads printing.
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
StatusCode finalize() override
Finalize Service.
boost::spirit::classic::position_iterator2< ForwardIterator > Iterator
constexpr static const auto FAILURE
void setupLimits(Gaudi::Details::PropertyBase &prop)
void setupThreshold(Gaudi::Details::PropertyBase &prop)
Gaudi::Property< bool > m_stats
std::string m_logColorCodes[MSG::NUM_LEVELS]
int messageCount(MSG::Level logLevel) const override
std::array< int, MSG::NUM_LEVELS > m_msgCount
std::array< Gaudi::Property< std::vector< std::string > >, MSG::NUM_LEVELS > m_thresholdProp
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.
AttribStringParser::Iterator begin(const AttribStringParser &parser)
std::array< Gaudi::Property< int >, MSG::NUM_LEVELS > m_msgLimit
int outputLevel() const override
void tee(const std::string &sourceName, const std::string &logFileName, const std::set< std::string > &declaredOutFileNames)
Gaudi::Property< bool > m_suppress
void insertMessage(const StatusCode &code, const Message &message) override
Gaudi::Property< std::map< std::string, std::string > > m_loggedStreamsName
static GAUDI_API bool enableCountInactive(bool value=true)
Enable/disable the count of inactive messages.
void insertStream(int message_type, const std::string &name, std::ostream *stream) override
std::recursive_mutex m_thresholdMapMutex
Mutex to synchronize multiple access to m_thresholdMap (.