lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Logger::LogFormatter Class Reference

Formats a LogRecord as: the time (if a time format is set), the 4-digit record counter, the 3-letter level, for levels other than INFO the file name (without directories), a colon and the line number, and the message text. More...

#include <Logger.hh>

Public Types

typedef Logger::LEVEL level_t
 Alias for Logger::LEVEL.
 

Public Member Functions

 LogFormatter (const std::string &fmt="", const std::string &timefmt="")
 Store timefmt; fmt is ignored.
 
virtual ~LogFormatter ()
 Destructor; does nothing.
 
virtual void addFormat (const level_t &level, const std::string &fmt)
 add format
 
virtual void setTimeFormat (const std::string &timefmt="")
 Set the strftime time format (f is replaced by milliseconds); an empty format leaves the time out.
 
virtual void format (const LogRecord &rec, std::ostream &out)
 format message to the output stream
 

Protected Member Functions

virtual const std::string & getFormat (const level_t &level) const
 get a format string for a given level
 

Detailed Description

Formats a LogRecord as: the time (if a time format is set), the 4-digit record counter, the 3-letter level, for levels other than INFO the file name (without directories), a colon and the line number, and the message text.

Member Typedef Documentation

◆ level_t

Constructor & Destructor Documentation

◆ LogFormatter()

Logger::LogFormatter::LogFormatter ( const std::string &  fmt = "",
const std::string &  timefmt = "" 
)

Store timefmt; fmt is ignored.

◆ ~LogFormatter()

virtual Logger::LogFormatter::~LogFormatter ( )
inlinevirtual

Destructor; does nothing.

Member Function Documentation

◆ addFormat()

virtual void Logger::LogFormatter::addFormat ( const level_t &  level,
const std::string &  fmt 
)
virtual

add format

◆ format()

virtual void Logger::LogFormatter::format ( const LogRecord &  rec,
std::ostream &  out 
)
virtual

format message to the output stream

◆ getFormat()

virtual const std::string & Logger::LogFormatter::getFormat ( const level_t &  level) const
protectedvirtual

get a format string for a given level

◆ setTimeFormat()

virtual void Logger::LogFormatter::setTimeFormat ( const std::string &  timefmt = "")
virtual

Set the strftime time format (f is replaced by milliseconds); an empty format leaves the time out.


The documentation for this class was generated from the following file: