![]() |
The Gaudi Framework
master (ff829712)
|
#include <GaudiKernel/Message.h>
Public Member Functions | |
Message ()=default | |
Default constructor. | |
Message (const char *src, int type, const char *msg) | |
Constructor. | |
Message (std::string src, int type, std::string msg) | |
Constructor. | |
~Message ()=default | |
Default destructor. | |
const std::string & | getMessage () const |
Get the message string. | |
void | setMessage (std::string msg) |
Set the message string. | |
int | getType () const |
Get the message type. | |
void | setType (int msg_type) |
Set the message type. | |
const std::string & | getSource () const |
Get the message source. | |
void | setSource (std::string_view src) |
Set the message source. | |
Private Attributes | |
Event identifiers | |
EventContext::ContextID_t | m_ecSlot { EventContext::INVALID_CONTEXT_ID } |
Event slot. | |
EventContext::ContextEvt_t | m_ecEvt { EventContext::INVALID_CONTEXT_EVT } |
Event number. | |
EventIDBase | m_ecEvtId |
Full event ID. | |
pthread_t | m_ecThrd {} |
Thread ID. | |
Static Private Attributes | |
Formatting characters | |
static const char | FORMAT_PREFIX = '%' |
The character used to prefix formatting commands. | |
static const char | JUSTIFY_LEFT = 'L' |
The character used to indicate start of left text justification. | |
static const char | JUSTIFY_RIGHT = 'R' |
The character used to indicate start of right text justification. | |
static const char | MESSAGE = 'M' |
The character used to indicate that the message should be printed. | |
static const char | TYPE = 'T' |
The character used to indicate that the message type should be printed. | |
static const char | TIME = 't' |
The character used to indicate that the message timestamp should be printed. | |
static const char | UTIME = 'u' |
The character used to indicate that the message timestamp should be printed in UTC time. | |
static const char | SOURCE = 'S' |
The character used to indicate that the message source should be printed. | |
static const char | COMP = 'C' |
The character used to indicate that the message source should be printed, focus on the component. | |
static const char | SLOT = 's' |
The character used to indicate that the slot number should be printed. | |
static const char | EVTNUM = 'e' |
The character used to indicate that the event number should be printed. | |
static const char | THREAD = 'X' |
The character used to indicate that the thread ID should be printed. | |
static const char | EVENTID = 'E' |
The character used to indicate that the full event ID should be printed. | |
static const char | FILL = 'F' |
The character used to indicate that the previous character is used to pad fields if the text is not long enough. | |
static const char | WIDTH = 'W' |
The character used to indicate that the previous decimal characters should be taken as the field width. | |
static constexpr const char * | DEFAULT_FORMAT = "% F%18W%S%7W%R%T %0W%M" |
The default message format. | |
static constexpr const char * | DEFAULT_TIME_FORMAT = "%Y-%m-%d %H:%M:%S,%f" |
The default time format (accepts strftime formatters plus %f for milliseconds). | |
Event identifiers of message | |
std::string | m_message |
The message text. | |
std::string | m_source { "UNKNOWN" } |
The message source. | |
int | m_type { 0 } |
The message type/level. | |
std::string | m_format { DEFAULT_FORMAT } |
The format string. | |
std::string | m_time_format { DEFAULT_TIME_FORMAT } |
Time format string. | |
std::string | m_formatted_msg |
Formatted message. | |
char | m_fill { ' ' } |
Current fill character. | |
int | m_width { 0 } |
Current field width. | |
bool | m_left { true } |
The message alignment. | |
EventContext::ContextID_t | getEventSlot () const |
EventContext::ContextEvt_t | getEventNumber () const |
const EventIDBase & | getEventID () const |
const std::string & | getFormat () const |
Get the format string. | |
void | setFormat (std::string msg) const |
Set the format string. | |
const std::string & | getTimeFormat () const |
Get the time format string. | |
void | setTimeFormat (std::string timeFormat) const |
Set the time format string. | |
static const std::string | getDefaultFormat () |
Get the default format string. | |
static const std::string | getDefaultTimeFormat () |
Get the default time format string. | |
bool | operator< (const Message &lhs, const Message &rhs) |
Needed to build maps. | |
std::ostream & | operator<< (std::ostream &stream, const Message &msg) |
Insert the message into a stream. | |
bool | operator== (const Message &a, const Message &b) |
Insert the message into a stream. | |
void | invalidFormat () const |
Called when an invalid format string is encountered. | |
void | makeFormattedMsg (const std::string &format) const |
Format the message. | |
void | decodeFormat (const std::string &format) const |
Decode format. | |
void | sizeField (const std::string &text, bool middle=false) const |
Truncate or pad the output string to the field width. If middle is true, cut the central part, otherwise the end. | |
void | setWidth (const std::string &formatArg) const |
Set the width of a stream. | |
The Message class.
This class is used to contain messages which can then be formatted and sent to a message service
|
default |
Default constructor.
Message::Message | ( | const char * | src, |
int | type, | ||
const char * | msg ) |
Constructor.
Definition at line 39 of file Message.cpp.
Message::Message | ( | std::string | src, |
int | type, | ||
std::string | msg ) |
Constructor.
Definition at line 48 of file Message.cpp.
|
default |
Default destructor.
|
private |
Decode format.
Definition at line 159 of file Message.cpp.
|
inlinestatic |
Get the default format string.
Definition at line 68 of file Message.h.
|
inlinestatic |
Get the default time format string.
Definition at line 77 of file Message.h.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
Called when an invalid format string is encountered.
Definition at line 271 of file Message.cpp.
|
private |
Format the message.
Definition at line 122 of file Message.cpp.
void Message::setFormat | ( | std::string | msg | ) | const |
|
inline |
|
inline |
void Message::setTimeFormat | ( | std::string | timeFormat | ) | const |
|
inline |
|
private |
Set the width of a stream.
Definition at line 290 of file Message.cpp.
|
private |
Truncate or pad the output string to the field width. If middle is true, cut the central part, otherwise the end.
Definition at line 305 of file Message.cpp.
|
friend |
|
staticprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
private |
|
private |
|
private |
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
private |
|
mutableprivate |
|
private |
|
mutableprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |