Go to the documentation of this file.
49 : m_message(
std::move(
msg ) ), m_source(
std::move( src ) ), m_type(
type ) {
65 msg.makeFormattedMsg(
msg.m_format );
166 switch ( FORMAT_TYPE ) {
168 if ( FORMAT_PARAM.
length() == 1 ) {
281 constexpr
struct all_digit_t {
282 template <
typename C>
283 bool operator()(
const C&
c )
const {
285 [](
typename C::const_reference i ) {
return isdigit( i ); } );
292 if ( all_digits( formatArg ) )
310 const size_t width =
static_cast<size_t>(
m_width );
312 if ( width < text.
length() ) {
313 if ( middle && width > 4 ) {
316 const size_t iDot = text.
rfind(
'.' );
317 if ( iDot != std::string::npos && width > text.
length() - iDot + 3 ) {
321 iTrunc = text.
length() - width / 2;
323 const size_t taillength = text.
length() - iTrunc;
324 const size_t frontlength = width - taillength - 3;
326 newText.
append( text, 0, frontlength );
328 newText.
append( text, iTrunc );
332 for (
int i = 0,
j = newText.
length() - 1; i < 3 && j >= 0; ++i, --
j ) newText[
j] =
'.';
Print levels enumeration.
static const char FILL
The character used to indicate that the previous character is used to pad fields if the text is not l...
EventContext::ContextEvt_t m_ecEvt
Event number.
static constexpr const char * DEFAULT_FORMAT
The default message format.
static const char FORMAT_PREFIX
The character used to prefix formatting commands.
std::string m_format
The format string.
static const char TYPE
The character used to indicate that the message type should be printed.
char m_fill
Current fill character.
void setTimeFormat(std::string timeFormat) const
Set the time format string.
GAUDI_API const EventContext & currentContext()
static const char SOURCE
The character used to indicate that the message source should be printed.
pthread_t m_ecThrd
Thread ID.
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,...
static const char WIDTH
The character used to indicate that the previous decimal characters should be taken as the field widt...
static constexpr const char * DEFAULT_TIME_FORMAT
The default time format (accepts strftime formatters plus %f for milliseconds).
static constexpr ContextID_t INVALID_CONTEXT_ID
static const char EVENTID
The character used to indicate that the full event ID should be printed.
static const char EVTNUM
The character used to indicate that the event number should be printed.
bool m_left
The message alignment.
Message()=default
Default constructor.
std::ostream & operator<<(std::ostream &stream, const Message &msg)
int m_width
Current field width.
int m_type
The message type/level.
static const char UTIME
The character used to indicate that the message timestamp should be printed in UTC time.
std::string format(bool local, std::string spec="%c") const
Format the time using strftime.
EventContext::ContextID_t m_ecSlot
Event slot.
static constexpr ContextEvt_t INVALID_CONTEXT_EVT
void setFormat(std::string msg) const
Set the format string.
void invalidFormat() const
Called when an invalid format string is encountered.
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
std::string m_message
The message text.
static const char TIME
The character used to indicate that the message timestamp should be printed.
bool operator==(const Message &a, const Message &b)
static const char JUSTIFY_LEFT
The character used to indicate start of left text justification.
static const char COMP
The character used to indicate that the message source should be printed, focus on the component.
std::string m_source
The message source.
static const char MESSAGE
The character used to indicate that the message should be printed.
static Time current()
Returns the current time.
static const char SLOT
The character used to indicate that the slot number should be printed.
static const char THREAD
The character used to indicate that the thread ID should be printed.
EventIDBase m_ecEvtId
Full event ID.
std::string m_formatted_msg
Formatted message.
std::string m_time_format
Time format string.
void decodeFormat(const std::string &format) const
Decode format.
bool operator<(const Message &lhs, const Message &rhs)
void makeFormattedMsg(const std::string &format) const
Format the message.
void setWidth(const std::string &formatArg) const
Set the width of a stream.
static const char JUSTIFY_RIGHT
The character used to indicate start of right text justification.