186 auto i = format.
begin();
187 while ( i != format.
end() ) {
193 if ( i == format.
end() )
break;
205 if ( i == format.
end() ) {
222 if ( !format.
empty() ) {
223 const char FORMAT_TYPE = format[format.
length() - 1];
228 switch ( FORMAT_TYPE ) {
230 if ( FORMAT_PARAM.
length() == 1 ) {
339 constexpr
struct all_digit_t {
340 template <
typename C>
343 [](
typename C::const_reference i ) {
return isdigit( i ); } );
350 if ( all_digits( formatArg ) )
372 for (
int i = 0, j = newText.
length() - 1; i < 3 && j >= 0; ++i, --j ) newText[j] =
'.';
static const char TYPE
The character used to indicate that the message type should be printed.
bool m_left
The message alignment.
static const char MESSAGE
The character used to indicate that the message should be printed.
const std::string & getFormat() const
Get the format string.
char m_fill
Current fill character.
static const char JUSTIFY_LEFT
The character used to indicate start of left text justification.
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
std::string m_formatted_msg
Formatted message.
static const char THREAD
The character used to indicate that the thread ID should be printed.
std::string m_time_format
Time format string.
void decodeFormat(const std::string &format) const
Decode format.
Message()=default
Default constructor.
void setWidth(const std::string &formatArg) const
Set the width of a stream.
bool operator<(const Message &test)
Needed to build maps.
EventContext::ContextEvt_t m_ecEvt
Event number.
static Time current()
Returns the current time.
std::string m_message
The message text.
void setMessage(std::string msg)
Set the message string.
void setType(int msg_type)
Set the message type.
int getType() const
Get the message type.
EventIDBase m_ecEvtId
Full event ID.
static const char EVENTID
The character used to indicate that the full event ID should be printed.
friend std::ostream & operator<<(std::ostream &stream, const Message &msg)
Insert the message into a stream.
void setSource(std::string src)
Set the message source.
void invalidFormat() const
Called when an invalid format string is encountered.
static constexpr ContextEvt_t INVALID_CONTEXT_EVT
static const std::string getDefaultTimeFormat()
Get the default time format string.
static const std::string getDefaultFormat()
Get the default format string.
static constexpr ContextID_t INVALID_CONTEXT_ID
static const char EVTNUM
The character used to indicate that the event number should be printed.
friend bool operator==(const Message &a, const Message &b)
Insert the message into a stream.
EventContext::ContextID_t m_ecSlot
Event slot.
int m_width
Current field width.
static const char TIME
The character used to indicate that the message timestamp should be printed.
std::string m_format
The format string.
void setFormat(std::string msg) const
Set the format string.
static const char JUSTIFY_RIGHT
The character used to indicate start of right text justification.
static const char UTIME
The character used to indicate that the message timestamp should be printed in UTC time...
virtual Out operator()(const vector_of_const_< In > &inputs) const =0
static const char SLOT
The character used to indicate that the slot number should be printed.
pthread_t m_ecThrd
Thread ID.
static const char FILL
The character used to indicate that the previous character is used to pad fields if the text is not l...
void makeFormattedMsg(const std::string &format) const
Format the message.
Print levels enumeration.
void setTimeFormat(std::string timeFormat) const
Set the time format string.
void sizeField(const std::string &text) const
Truncate or pad the output string to the field width as necessary.
const std::string & getSource() const
Get the message source.
const std::string & getTimeFormat() const
Get the time format string.
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_source
The message source.
static const char WIDTH
The character used to indicate that the previous decimal characters should be taken as the field widt...
static const char SOURCE
The character used to indicate that the message source should be printed.
static constexpr const char * DEFAULT_TIME_FORMAT
The default time format (accepts strftime formatters plus %f for milliseconds).
std::string format(bool local, std::string spec="%c") const
Format the time using strftime.
const std::string & getMessage() const
Get the message string.
int m_type
The message type/level.