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

Classes

class  LogFormatter
 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...
 
class  Logger
 Singleton logger (instance()) with a minimum level and a list of handlers; log() passes each record to every handler. More...
 
class  LogHandler
 Abstract handler that writes LogRecords with a LogFormatter it owns (a default one is created on first use if none was set). More...
 
class  LogHandlerStdStreams
 Handler that formats records of level INFO or lower to stdout and higher levels to stderr, each followed by std::endl. More...
 
class  LogRecord
 One log message: logger name (held by reference), level, source file and line, and a pointer to the stream buffer with the text. More...
 
class  LogStream
 String stream that collects one message and, when destroyed, passes it to the singleton as a LogRecord. More...
 

Detailed Description

Usage mainstream:

#include "psalg/include/Logger.hh" // MSG, MSGLOG, LOGGER, MSGSTREAM

MSG(INFO, LOGGER.tstampStart() << " Logger started"); // optional record LOGGER.setLogger(LL::DEBUG, "%H:%M:%S.%f"); // set level and time format

MSG(DEBUG, "Test MSG DEBUG" << " as stream"); MSG(TRACE, "Test MSG TRACE"); MSG(INFO, "Test MSG INFO"); MSG(WARNING, "Test MSG WARNING"); MSG(ERROR, "Test MSG ERROR"); MSG(FATAL, "Test MSG FATAL"); MSG(NOLOG, "Test MSG NOLOG"); MSGSTREAM(INFO, out){out << "Test MSGSTREAM INFO"; out << " which supports block of output statements as a single message";}

Usage optional

LOGGER.setLevel(LL::DEBUG); LOGGER.setTimeFormat("%Y-%m-%d %H:%M:%S.%f"); LOGGER.loggerInfo(std::cout); // or Logger::Logger::instance()->loggerIinfo(out);