4#ifndef TRIGSERVICES_TRIGMESSAGESVC_H
5#define TRIGSERVICES_TRIGMESSAGESVC_H
17#include "tbb/concurrent_queue.h"
23#include "GaudiKernel/IIncidentListener.h"
24#include "GaudiKernel/IMessageSvc.h"
25#include "GaudiKernel/Message.h"
26#include "Gaudi/Property.h"
27#include "GaudiKernel/Service.h"
28#include "GaudiKernel/StatusCode.h"
32 throw std::logic_error(std::string(__func__) + " is not supported by TrigMessageSvc")
56class TrigMessageSvc :
public extends<Service, IMessageSvc, IIncidentListener> {
64 virtual StatusCode
start()
override;
65 virtual StatusCode
stop()
override;
66 virtual StatusCode
finalize()
override;
67 virtual void handle(
const Incident& incident )
override;
71 virtual void reportMessage(std::string source,
int type, std::string message)
override;
83 virtual int outputLevel(std::string_view source)
const override;
85 virtual void setOutputLevel(std::string_view source,
int new_level)
override;
86 virtual int messageCount(MSG::Level logLevel)
const override;
89 virtual std::string
getLogColor(
int)
const override {
return ""; }
108 Gaudi::Property<std::string>
m_defaultFormat{
this,
"Format", Message::getDefaultFormat(),
109 "Default message format"};
110 Gaudi::Property<std::string>
m_ersFormat{
this,
"ErsFormat", Message::getDefaultFormat(),
111 "ERS message format"};
113 this,
"timeFormat", Message::getDefaultTimeFormat(),
"Message time format"};
114 Gaudi::Property<bool>
m_stats{
this,
"showStats",
false,
"Show message statistics"};
116 "Show total message statistics for >= level"};
118 "Publish message statistics for this and higher message levels"};
119 Gaudi::Property<unsigned int>
m_eventIDLevel{
this,
"printEventIDLevel", MSG::NIL,
120 "Print event ID for this and higher message levels"};
121 Gaudi::Property<bool>
m_color{
this,
"useColors",
false,
122 "Colors are not supported by TrigMessageSvc"};
123 Gaudi::Property<bool>
m_suppress{
this,
"enableSuppression",
false,
"Enable message suppression"};
125 "Use message suppression only during RUNNING state"};
127 std::array<Gaudi::Property<std::vector<std::string>>, MSG::NUM_LEVELS>
m_thresholdProp{
129 {
this,
"setVerbose"},
132 {
this,
"setWarning"},
135 {
this,
"setAlways"}}};
137 std::array<Gaudi::Property<int>, MSG::NUM_LEVELS>
m_msgLimit{{{
this,
"defaultLimit", 500},
138 {
this,
"verboseLimit", 500},
139 {
this,
"debugLimit", 500},
140 {
this,
"infoLimit", 500},
141 {
this,
"warningLimit", 500},
142 {
this,
"errorLimit", 500},
143 {
this,
"fatalLimit", 500},
144 {
this,
"alwaysLimit", 0}}};
155 std::array<Gaudi::Property<std::vector<std::string>>, MSG::NUM_LEVELS>
m_useERS{
157 {
this,
"useErsVerbose", {}},
158 {
this,
"useErsDebug", {}},
159 {
this,
"useErsInfo", {}},
160 {
this,
"useErsWarning", {}},
161 {
this,
"useErsError", {}},
162 {
this,
"useErsFatal", {}},
163 {
this,
"useErsAlways", {}}}};
166 "Maximum number of messages (per event and level) that are forwarded to ERS (-1: disabled)"};
177 std::array<int, MSG::NUM_LEVELS>
msg = {{0}};
185 std::unordered_map<EventContext::ContextID_t,
200 void setupLimits(Gaudi::Details::PropertyBase& prop);
202 bool passErsFilter(
const std::string& source,
const std::vector<std::string>& filter)
const;
Define macros for attributes used to control the static checker.
virtual void eraseMessage(const StatusCode &) override
bool passErsFilter(const std::string &source, const std::vector< std::string > &filter) const
virtual std::string getLogColor(int) const override
Gaudi::Property< std::string > m_ersFormat
virtual void eraseStream(int, std::ostream *) override
tbb::concurrent_bounded_queue< std::function< void()> > m_messageActionsQueue
virtual void eraseStream(std::ostream *) override
void setupLimits(Gaudi::Details::PropertyBase &prop)
virtual int outputLevel() const override
virtual StatusCode finalize() override
void i_reportMessage(const Message &msg, int outputLevel)
Internal implementation of reportMessage(const Message&,int) without lock.
bool passErsLimit(const Message &msg)
std::array< Gaudi::Property< int >, MSG::NUM_LEVELS > m_msgLimit
virtual StatusCode start() override
Gaudi::Property< std::string > m_defaultTimeFormat
std::map< std::string, MsgAry > m_sourceMap
counts per source
std::map< size_t, unsigned int > m_msgHashCount
counts per message hash
std::array< Gaudi::Property< std::vector< std::string > >, MSG::NUM_LEVELS > m_thresholdProp
std::unordered_map< EventContext::ContextID_t, std::pair< EventContext::ContextEvt_t, MsgAry > > m_slotMsgCount
counts per slot and level
std::array< Gaudi::Property< std::vector< std::string > >, MSG::NUM_LEVELS > m_useERS
Special properties to control output to ERS of individual sources.
Gaudi::Property< bool > m_color
std::recursive_mutex m_thresholdMapMutex
virtual void reportMessage(const Message &message) override
TH1I * m_msgCountHist
Message counting per level histogram.
void i_reportERS(const Message &msg) const
Report message to online messaging system (ERS)
bool m_doPublish
are we publishing message statistics?
virtual void insertMessage(const StatusCode &, Message) override
Gaudi::Property< std::string > m_defaultFormat
std::map< std::string, int, std::less<> > ThresholdMap
virtual void eraseMessage(const StatusCode &, const Message &) override
ThresholdMap m_thresholdMap
Output level threshold map.
void setupThreshold(Gaudi::Details::PropertyBase &prop)
Gaudi::Property< bool > m_stats
virtual StatusCode stop() override
virtual void eraseStream() override
Gaudi::Property< bool > m_suppressRunningOnly
virtual int messageCount(MSG::Level logLevel) const override
bool m_doSuppress
is suppression currently enabled?
virtual bool useColor() const override
TH2I * m_msgCountSrcHist
Message counting per message source.
Gaudi::Property< int > m_ersEventLimit
virtual void eraseMessage() override
Gaudi::Property< unsigned int > m_statLevel
virtual void setOutputLevel(int new_level) override
std::array< int, MSG::NUM_LEVELS > m_msgCount
counts per level
virtual StatusCode reinitialize() override
virtual void handle(const Incident &incident) override
Gaudi::Property< unsigned int > m_eventIDLevel
virtual void insertStream(int, std::string, std::ostream *) override
Gaudi::Property< bool > m_suppress
std::thread m_thread
Thread for asynchronous reporting.
virtual void reportMessage(const StatusCode &, std::string_view) override
Not supported by this implementation.
Gaudi::Property< unsigned int > m_publishLevel
virtual StatusCode initialize() override
TrigMessageSvc(const std::string &name, ISvcLocator *svcloc)
std::ostream * m_defaultStream
Pointer to the output stream.
virtual void setDefaultStream(std::ostream *stream) override
virtual std::ostream *defaultStream ATLAS_NOT_CONST_THREAD_SAFE() const override
virtual void eraseStream(int) override
MsgAry()=default
Default constructor.
std::array< int, MSG::NUM_LEVELS > msg
Internal array of counters.