The Gaudi Framework  master (37c0b60a)
IMessageSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef GAUDIKERNEL_IMESSAGESVC_H
12 #define GAUDIKERNEL_IMESSAGESVC_H
13 
14 // Include files
15 #include <GaudiKernel/IInterface.h>
16 #include <iostream>
17 #include <string>
18 
19 // Forward declarations
20 class StatusCode;
21 class Message;
22 
24 namespace MSG {
27 } // namespace MSG
28 
29 #ifdef _WIN32
30 // Avoid (hopefully) conflicts between Windows' headers and MSG.
31 # ifndef NOMSG
32 # define NOMSG
33 # ifndef NOGDI
34 # define NOGDI
35 # endif
36 # endif
37 #endif
38 
47 class GAUDI_API IMessageSvc : virtual public IInterface {
48 public:
51 
56  virtual void reportMessage( const Message& msg, int outputLevel ) = 0;
57 
61  virtual void reportMessage( const Message& message ) = 0;
62 
68  virtual void reportMessage( const StatusCode& code, std::string_view source = "" ) = 0;
69 
75  virtual void reportMessage( std::string source, int type, std::string message ) = 0;
76 
81  virtual void insertMessage( const StatusCode& code, Message message ) = 0;
82 
84  virtual void eraseMessage() = 0;
85 
87  virtual void eraseMessage( const StatusCode& code ) = 0;
88 
93  virtual void eraseMessage( const StatusCode& code, const Message& message ) = 0;
94 
100  virtual void insertStream( int type, std::string name, std::ostream* stream ) = 0;
101 
103  virtual void eraseStream() = 0;
104 
106  virtual void eraseStream( int message_type ) = 0;
107 
112  virtual void eraseStream( int type, std::ostream* stream ) = 0;
113 
117  virtual void eraseStream( std::ostream* stream ) = 0;
118 
120  virtual std::ostream* defaultStream() const = 0;
121 
125  virtual void setDefaultStream( std::ostream* stream ) = 0;
126 
128  virtual int outputLevel() const = 0;
129 
133  virtual int outputLevel( std::string_view source ) const = 0;
134 
136  virtual void setOutputLevel( int new_level ) = 0;
137 
142  virtual void setOutputLevel( std::string_view source, int new_level ) = 0;
143 
146  virtual bool useColor() const = 0;
147 
151  virtual std::string getLogColor( int logLevel ) const = 0;
152 
155  virtual int messageCount( MSG::Level level ) const = 0;
156 };
157 
159 public:
162 
167  virtual void incrInactiveCount( MSG::Level level, std::string_view src ) = 0;
168 };
169 
170 #endif // GAUDIKERNEL_IMESSAGESVC_H
MSG::DEBUG
@ DEBUG
Definition: IMessageSvc.h:25
MSG
Print levels enumeration.
Definition: IMessageSvc.h:24
Write.stream
stream
Definition: Write.py:32
precedence.message
message
Definition: precedence.py:19
std::string
STL class.
IMessageSvc
Definition: IMessageSvc.h:47
MSG::Color
Color
Definition: IMessageSvc.h:26
MSG::INFO
@ INFO
Definition: IMessageSvc.h:25
IMessageSvc::getLogColor
virtual std::string getLogColor(int logLevel) const =0
Get the color codes for various log levels.
IMessageSvc::setOutputLevel
virtual void setOutputLevel(int new_level)=0
Set new global output level threshold.
MSG::BLACK
@ BLACK
Definition: IMessageSvc.h:26
IInactiveMessageCounter
Definition: IMessageSvc.h:158
IMessageSvc::defaultStream
virtual std::ostream * defaultStream() const =0
Get the default stream.
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:19
MSG::WARNING
@ WARNING
Definition: IMessageSvc.h:25
MSG::BLUE
@ BLUE
Definition: IMessageSvc.h:26
IMessageSvc::eraseStream
virtual void eraseStream(int type, std::ostream *stream)=0
Delete a single stream for a given message type (severity level)
IMessageSvc::useColor
virtual bool useColor() const =0
Show whether colors are used.
IMessageSvc::reportMessage
virtual void reportMessage(const Message &msg, int outputLevel)=0
Report a message by sending a Message object to the message service.
MSG::PURPLE
@ PURPLE
Definition: IMessageSvc.h:26
IMessageSvc::outputLevel
virtual int outputLevel() const =0
Retrieve the current output level threshold.
IMessageSvc::eraseStream
virtual void eraseStream(std::ostream *stream)=0
Delete all occurrences of a stream.
IMessageSvc::eraseMessage
virtual void eraseMessage(const StatusCode &code, const Message &message)=0
Erase a given message associated to a given status code.
IMessageSvc::DeclareInterfaceID
DeclareInterfaceID(IMessageSvc, 2, 0)
InterfaceID.
StatusCode
Definition: StatusCode.h:65
IInterface.h
Message
Definition: Message.h:26
IMessageSvc::insertMessage
virtual void insertMessage(const StatusCode &code, Message message)=0
Insert a message to be sent for a given status code into the error code repository.
std::ostream
STL class.
IMessageSvc::eraseStream
virtual void eraseStream(int message_type)=0
Delete all the streams for a given message type (severity level).
IMessageSvc::outputLevel
virtual int outputLevel(std::string_view source) const =0
Retrieve the current output level threshold for a given message source.
IMessageSvc::insertStream
virtual void insertStream(int type, std::string name, std::ostream *stream)=0
Add a new stream for a message type (severity level).
gaudirun.level
level
Definition: gaudirun.py:364
MSG::FATAL
@ FATAL
Definition: IMessageSvc.h:25
IMessageSvc::reportMessage
virtual void reportMessage(std::string source, int type, std::string message)=0
Report a message by specifying the source, severity level and text.
IMessageSvc::eraseStream
virtual void eraseStream()=0
Delete all the streams.
IMessageSvc::eraseMessage
virtual void eraseMessage(const StatusCode &code)=0
Erase message associated to a given status code.
IMessageSvc::reportMessage
virtual void reportMessage(const Message &message)=0
Report a message by sending a Message object to the message service.
IInactiveMessageCounter::DeclareInterfaceID
DeclareInterfaceID(IInactiveMessageCounter, 2, 0)
InterfaceID.
MSG::RED
@ RED
Definition: IMessageSvc.h:26
IMessageSvc::setOutputLevel
virtual void setOutputLevel(std::string_view source, int new_level)=0
Set new output level threshold for a given message source.
MSG::Level
Level
Definition: IMessageSvc.h:25
gaudirun.type
type
Definition: gaudirun.py:160
IMessageSvc::messageCount
virtual int messageCount(MSG::Level level) const =0
Get the number of messages issued at a particular level.
MSG::VERBOSE
@ VERBOSE
Definition: IMessageSvc.h:25
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
MSG::WHITE
@ WHITE
Definition: IMessageSvc.h:26
MSG::ALWAYS
@ ALWAYS
Definition: IMessageSvc.h:25
MSG::NIL
@ NIL
Definition: IMessageSvc.h:25
MSG::ERROR
@ ERROR
Definition: IMessageSvc.h:25
IInterface
Definition: IInterface.h:239
MSG::CYAN
@ CYAN
Definition: IMessageSvc.h:26
MSG::GREEN
@ GREEN
Definition: IMessageSvc.h:26
IMessageSvc::setDefaultStream
virtual void setDefaultStream(std::ostream *stream)=0
Set the default stream.
IMessageSvc::reportMessage
virtual void reportMessage(const StatusCode &code, std::string_view source="")=0
Report an error to the message service.
IMessageSvc::eraseMessage
virtual void eraseMessage()=0
Erase all messages associated to all status codes.
MSG::NUM_LEVELS
@ NUM_LEVELS
Definition: IMessageSvc.h:25
MSG::NUM_COLORS
@ NUM_COLORS
Definition: IMessageSvc.h:26
IInactiveMessageCounter::incrInactiveCount
virtual void incrInactiveCount(MSG::Level level, std::string_view src)=0
Increment deactivated message count.
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
MSG::YELLOW
@ YELLOW
Definition: IMessageSvc.h:26