Go to the documentation of this file.
36 template <
typename Container,
typename Iterator,
typename Predicate>
38 while ( first != last ) {
40 first =
c.erase( first );
46 template <
typename Container,
typename Iterator,
typename Predicate>
51 std::string colTrans( std::string_view col,
int offset ) {
70 "WARNING",
"ERROR",
"FATAL",
"ALWAYS" };
77 if (
app )
app->outputLevelUpdate();
137 :
pname ==
"alwaysColorCode"
146 if ( col_desc.size() == 1 ) {
148 if ( desc.
empty() ) {
150 }
else if ( desc[0] ==
'[' ) {
151 code =
"\033" + desc;
153 code =
"\033[" + colTrans( desc, 90 ) +
";1m";
155 }
else if ( col_desc.size() == 2 ) {
156 code =
"\033[" + colTrans( col_desc[0], 90 ) +
";" + colTrans( col_desc[1], 100 ) +
";1m";
165 if ( prop.
name() ==
"alwaysLimit" ) {
167 if ( p && p->
value() != 0 ) {
171 }
else if ( prop.
name() ==
"defaultLimit" ) {
175 }
else if ( prop.
name() !=
"fatalLimit" && prop.
name() !=
"errorLimit" && prop.
name() !=
"warningLimit" &&
176 prop.
name() ==
"infoLimit" && prop.
name() ==
"debugLimit" && prop.
name() ==
"verboseLimit" ) {
204 <<
" to a Gaudi::Property<std::vector<std::string>> (which it should be!)" <<
std::endl;
216 if ( prop.
name() ==
"countInactive" ) {
233 os <<
"Summarizing all message counts" <<
std::endl;
235 os <<
"Listing sources of suppressed message: " <<
std::endl;
238 os <<
"=====================================================" <<
std::endl;
239 os <<
" Message Source | Level | Count" <<
std::endl;
240 os <<
"-----------------------------+---------+-------------" <<
std::endl;
250 os.
setf( std::ios_base::left, std::ios_base::adjustfield );
255 os.
setf( std::ios_base::right, std::ios_base::adjustfield );
256 os << levelNames[ic];
260 os << itr->second.msg[ic];
267 os <<
"=====================================================" <<
std::endl;
275 os <<
"Listing sources of Unprotected and Unseen messages\n";
279 unsigned int ml( 0 );
282 if ( itr.second.msg[ic] != 0 && itr.first.length() > ml ) { ml = itr.first.length(); }
286 for (
unsigned int i = 0; i < ml + 25; ++i ) os <<
"=";
290 os.
setf( std::ios_base::left, std::ios_base::adjustfield );
291 os <<
"Message Source";
295 for (
unsigned int i = 0; i < ml + 3; ++i ) os <<
"-";
296 os <<
"+---------+-----------" <<
std::endl;
300 if ( itr->second.msg[ic] != 0 ) {
303 os.
setf( std::ios_base::left, std::ios_base::adjustfield );
309 os.
setf( std::ios_base::right, std::ios_base::adjustfield );
310 os << levelNames[ic];
315 os << itr->second.msg[ic];
323 for (
unsigned int i = 0; i < ml + 25; ++i ) os <<
"=";
367 ") reached for " +
msg.getSource() +
". Suppressing further output.";
377 [&]( StreamMap::const_reference sm ) { *sm.second.second << *cmsg << std::endl; } );
388 if ( cmsg != &
msg ) {
delete cmsg; }
422 auto report = [&](
Message mesg ) {
423 mesg.setSource( source );
476 [&]( StreamMap::const_reference
j ) { return j.second.second == stream; } );
489 erase_if(
m_streamMap, [&]( StreamMap::const_reference
j ) {
return j.second.second ==
stream; } );
540 [&]( MessageMap::const_reference
j ) { return j.second == msg; } );
572 }
else if ( i->second !=
level ) {
590 ++entry->second.msg[
level];
594 std::cout <<
"== inactive message detected from " << source <<
" ==\n";
611 [](
const auto& p ) -> std::string_view { return p.second; } );
615 []( std::string_view fname ) {
616 return std::pair{ fname, std::make_shared<std::ofstream>(
617 std::string{ fname }, std::ios_base::out | std::ios_base::trunc ) };
620 for (
auto& iProp : m_loggedStreamsName ) {
621 auto&
stream = outStreams.at( iProp.second );
622 if (
stream->good() ) m_loggedStreams.emplace( iProp.first,
stream );
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
const std::string name() const
property name
StatusCode reinitialize() override
Reinitialize Service.
std::array< Gaudi::Property< std::vector< std::string > >, MSG::NUM_LEVELS > m_logColors
StatusCode initialize() override
void setupLimits(Gaudi::Details::PropertyBase &prop)
Gaudi::Property< bool > m_stats
static GAUDI_API bool enableCountInactive(bool value=true)
Enable/disable the count of inactive messages.
Gaudi::StateMachine::State m_state
Service state
Private helper class to keep the count of messages of a type (MSG::LEVEL).
Gaudi::Property< std::string > m_defaultTimeFormat
void insertMessage(const StatusCode &code, Message message) override
void incrInactiveCount(MSG::Level level, std::string_view src) override
void reportMessage(const Message &message) override
std::string m_logColorCodes[MSG::NUM_LEVELS]
std::recursive_mutex m_reportMutex
Mutex to synchronize multiple threads printing.
virtual void i_reportMessage(const Message &msg, int outputLevel)
Internal implementation of reportMessage(const Message&,int) without lock.
int messageCount(MSG::Level logLevel) const override
GAUDI_API int backTrace(void **addresses, const int depth)
bool setValue(const ValueType &v)
StreamMap m_streamMap
Stream map.
std::recursive_mutex m_thresholdMapMutex
Mutex to synchronize multiple access to m_thresholdMap (.
std::array< Gaudi::Property< int >, MSG::NUM_LEVELS > m_msgLimit
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Gaudi::Property< unsigned int > m_statLevel
const std::string & name() const override
Retrieve name of the service
std::map< std::string, MsgAry, std::less<> > m_sourceMap
Details::PropertyBase & declareUpdateHandler(std::function< void(Details::PropertyBase &)> fun) override
set new callback for update
std::array< int, MSG::NUM_LEVELS > m_msgCount
const ValueType & value() const
void setFormat(std::string msg) const
Set the format string.
Message m_defaultMessage
Default Message.
ThresholdMap m_thresholdMap
Output level threshold map.
MessageMap m_messageMap
Message map.
void setupThreshold(Gaudi::Details::PropertyBase &prop)
Gaudi::Property< std::vector< std::string > > m_tracedInactiveSources
std::map< std::string, MsgAry, std::less<> > m_inactiveMap
int outputLevel() const override
StatusCode finalize() override
Finalize Service.
Gaudi::Property< bool > m_inactCount
constexpr static const auto SUCCESS
std::recursive_mutex m_messageMapMutex
Mutex to synchronize multiple access to m_messageMap.
std::pair< std::string, std::ostream * > NamedStream
Gaudi::Property< std::map< std::string, std::string, std::less<> > > m_loggedStreamsName
void setupInactCount(Gaudi::Details::PropertyBase &prop)
#define DECLARE_COMPONENT(type)
void eraseMessage() override
Gaudi::Property< bool > m_color
code_t getCode() const
Retrieve value.
std::map< std::string, std::shared_ptr< std::ostream >, std::less<> > m_loggedStreams
StatusCode initialize() override
Initialize Service.
std::string getLogColor(int logLevel) const override
constexpr static const auto FAILURE
void eraseStream() override
std::array< Gaudi::Property< std::vector< std::string > >, MSG::NUM_LEVELS > m_thresholdProp
MessageSvc(const std::string &name, ISvcLocator *svcloc)
Gaudi::Property< bool > m_suppress
void insertStream(int message_type, std::string name, std::ostream *stream) override
Gaudi::Property< std::string > m_defaultFormat
void setOutputLevel(int new_level) override
Gaudi::Property< int > m_outputLevel
flag indicating whether ToolHandle tools have been added to m_tools
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.
boost::spirit::classic::position_iterator2< ForwardIterator > Iterator
void setupColors(Gaudi::Details::PropertyBase &prop)