Loading [MathJax]/extensions/tex2jax.js
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 Predicate>
47 void erase_if( Container&
c, Predicate pred ) {
51 template <
typename Container,
typename Iterator,
typename Predicate>
56 std::string colTrans( std::string_view col,
int offset ) {
75 "WARNING",
"ERROR",
"FATAL",
"ALWAYS" };
82 if (
app )
app->outputLevelUpdate();
142 :
pname ==
"alwaysColorCode"
151 if ( col_desc.size() == 1 ) {
153 if ( desc.
empty() ) {
155 }
else if ( desc[0] ==
'[' ) {
156 code =
"\033" + desc;
158 code =
"\033[" + colTrans( desc, 90 ) +
";1m";
160 }
else if ( col_desc.size() == 2 ) {
161 code =
"\033[" + colTrans( col_desc[0], 90 ) +
";" + colTrans( col_desc[1], 100 ) +
";1m";
170 if ( prop.
name() ==
"alwaysLimit" ) {
172 if ( p && p->
value() != 0 ) {
176 }
else if ( prop.
name() ==
"defaultLimit" ) {
180 }
else if ( prop.
name() !=
"fatalLimit" && prop.
name() !=
"errorLimit" && prop.
name() !=
"warningLimit" &&
181 prop.
name() ==
"infoLimit" && prop.
name() ==
"debugLimit" && prop.
name() ==
"verboseLimit" ) {
209 <<
" to a Gaudi::Property<std::vector<std::string>> (which it should be!)" <<
std::endl;
221 if ( prop.
name() ==
"countInactive" ) {
238 os <<
"Summarizing all message counts" <<
std::endl;
240 os <<
"Listing sources of suppressed message: " <<
std::endl;
243 os <<
"=====================================================" <<
std::endl;
244 os <<
" Message Source | Level | Count" <<
std::endl;
245 os <<
"-----------------------------+---------+-------------" <<
std::endl;
255 os.
setf( std::ios_base::left, std::ios_base::adjustfield );
260 os.
setf( std::ios_base::right, std::ios_base::adjustfield );
261 os << levelNames[ic];
265 os << itr->second.msg[ic];
272 os <<
"=====================================================" <<
std::endl;
280 os <<
"Listing sources of Unprotected and Unseen messages\n";
284 unsigned int ml( 0 );
287 if ( itr.second.msg[ic] != 0 && itr.first.length() > ml ) { ml = itr.first.length(); }
291 for (
unsigned int i = 0; i < ml + 25; ++i ) os <<
"=";
295 os.
setf( std::ios_base::left, std::ios_base::adjustfield );
296 os <<
"Message Source";
300 for (
unsigned int i = 0; i < ml + 3; ++i ) os <<
"-";
301 os <<
"+---------+-----------" <<
std::endl;
305 if ( itr->second.msg[ic] != 0 ) {
308 os.
setf( std::ios_base::left, std::ios_base::adjustfield );
314 os.
setf( std::ios_base::right, std::ios_base::adjustfield );
315 os << levelNames[ic];
320 os << itr->second.msg[ic];
328 for (
unsigned int i = 0; i < ml + 25; ++i ) os <<
"=";
372 ") reached for " +
msg.getSource() +
". Suppressing further output.";
382 [&]( StreamMap::const_reference sm ) { *sm.second.second << *cmsg << std::endl; } );
393 if ( cmsg != &
msg ) {
delete cmsg; }
427 auto report = [&](
Message mesg ) {
428 mesg.setSource( source );
481 [&]( StreamMap::const_reference
j ) { return j.second.second == stream; } );
494 erase_if(
m_streamMap, [&]( StreamMap::const_reference
j ) {
return j.second.second ==
stream; } );
545 [&]( MessageMap::const_reference
j ) { return j.second == msg; } );
577 }
else if ( i->second !=
level ) {
595 ++entry->second.msg[
level];
599 std::cout <<
"== inactive message detected from " << source <<
" ==\n";
616 [](
const auto& p ) -> std::string_view { return p.second; } );
620 []( std::string_view fname ) {
621 return std::pair{ fname, std::make_shared<std::ofstream>(
622 std::string{ fname }, std::ios_base::out | std::ios_base::trunc ) };
625 for (
auto& iProp : m_loggedStreamsName ) {
626 auto&
stream = outStreams.at( iProp.second );
627 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
Gaudi::Property< unsigned int > m_statLevel
const std::string & name() const override
Retrieve name of the service
double * begin(CLHEP::HepVector &v)
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)