26 template <
typename Container,
typename Iterator,
typename Predicate>
28 while ( first != last ) {
30 first =
c.erase( first );
36 template <
typename Container,
typename Predicate>
37 void erase_if( Container&
c, Predicate pred ) {
41 template <
typename Container,
typename Iterator,
typename Predicate>
50 else if ( col ==
"red" )
52 else if ( col ==
"green" )
54 else if ( col ==
"yellow" )
56 else if ( col ==
"blue" )
58 else if ( col ==
"purple" )
60 else if ( col ==
"cyan" )
62 else if ( col ==
"white" )
75 "WARNING",
"ERROR",
"FATAL",
"ALWAYS"};
136 if (
pname ==
"fatalColorCode" )
138 else if (
pname ==
"errorColorCode" )
140 else if (
pname ==
"warningColorCode" )
142 else if (
pname ==
"infoColorCode" )
144 else if (
pname ==
"debugColorCode" )
146 else if (
pname ==
"verboseColorCode" )
148 else if (
pname ==
"alwaysColorCode" )
158 if ( col_desc.size() == 1 ) {
160 if ( desc.
empty() ) {
162 }
else if ( desc[0] ==
'[' ) {
163 code =
"\033" + desc;
165 code =
"\033[" + colTrans( desc, 90 ) +
";1m";
167 }
else if ( col_desc.size() == 2 ) {
168 code =
"\033[" + colTrans( col_desc[0], 90 ) +
";" + colTrans( col_desc[1], 100 ) +
";1m";
177 if ( prop.
name() ==
"alwaysLimit" ) {
179 if ( p && p->
value() != 0 ) {
183 }
else if ( prop.
name() ==
"defaultLimit" ) {
187 }
else if ( prop.
name() !=
"fatalLimit" && prop.
name() !=
"errorLimit" && prop.
name() !=
"warningLimit" &&
188 prop.
name() ==
"infoLimit" && prop.
name() ==
"debugLimit" && prop.
name() ==
"verboseLimit" ) {
216 <<
" to a Gaudi::Property<std::vector<std::string>> (which it should be!)" <<
std::endl;
228 if ( prop.
name() ==
"countInactive" ) {
245 os <<
"Summarizing all message counts" <<
std::endl;
247 os <<
"Listing sources of suppressed message: " <<
std::endl;
250 os <<
"=====================================================" <<
std::endl;
251 os <<
" Message Source | Level | Count" <<
std::endl;
252 os <<
"-----------------------------+---------+-------------" <<
std::endl;
262 os.
setf( std::ios_base::left, std::ios_base::adjustfield );
267 os.
setf( std::ios_base::right, std::ios_base::adjustfield );
268 os << levelNames[ic];
272 os << itr->second.msg[ic];
279 os <<
"=====================================================" <<
std::endl;
287 os <<
"Listing sources of Unprotected and Unseen messages\n";
291 unsigned int ml( 0 );
294 if ( itr.second.msg[ic] != 0 && itr.first.length() > ml ) { ml = itr.first.length(); }
298 for (
unsigned int i = 0; i < ml + 25; ++i ) os <<
"=";
302 os.
setf( std::ios_base::left, std::ios_base::adjustfield );
303 os <<
"Message Source";
307 for (
unsigned int i = 0; i < ml + 3; ++i ) os <<
"-";
308 os <<
"+---------+-----------" <<
std::endl;
312 if ( itr->second.msg[ic] != 0 ) {
315 os.
setf( std::ios_base::left, std::ios_base::adjustfield );
321 os.
setf( std::ios_base::right, std::ios_base::adjustfield );
322 os << levelNames[ic];
327 os << itr->second.msg[ic];
335 for (
unsigned int i = 0; i < ml + 25; ++i ) os <<
"=";
357 int key =
msg.getType();
379 ") reached for " +
msg.getSource() +
". Suppressing further output.";
389 [&]( StreamMap::const_reference sm ) { *sm.second.second << *cmsg << std::endl; } );
400 if ( cmsg != &
msg ) {
delete cmsg; }
444 auto report = [&](
Message mesg ) {
445 mesg.setSource( source );
498 [&]( StreamMap::const_reference j ) {
return j.second.second == stream; } );
511 erase_if(
m_streamMap, [&]( StreamMap::const_reference j ) {
return j.second.second == stream; } );
562 [&]( MessageMap::const_reference j ) {
return j.second ==
msg; } );
594 }
else if ( i->second !=
level ) {
630 if ( jProp.first != iProp.first ) { outFileNames.
insert( jProp.second ); }
632 tee( iProp.first, iProp.second, outFileNames );
640 const std::ios_base::openmode openMode = std::ios_base::out | std::ios_base::trunc;
648 if ( outFileNames.
find( outFileName ) != outFileNames.
end() ) {
654 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 (.