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

String stream that collects one message and, when destroyed, passes it to the singleton as a LogRecord. More...

#include <Logger.hh>

Inherits std::stringstream.

Public Types

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

Public Member Functions

 LogStream (const std::string &logname, const level_t &sev, const char *file=0, int line=-1)
 Store the logger name, level and source location; ok() starts as LOGGER.logging(sev).
 
virtual ~LogStream ()
 Pass the collected text to LOGGER.log() as a LogRecord.
 
std::ostream & logger_ostream ()
 Return this stream as a std::ostream reference.
 
const char * file () const
 Return the source file name given to the constructor.
 
const int line () const
 Return the source line given to the constructor.
 
bool ok () const
 get the state of the stream
 
void finish ()
 Set ok() to false; MSGSTREAM uses this to end its one-pass loop.
 

Detailed Description

String stream that collects one message and, when destroyed, passes it to the singleton as a LogRecord.

Used by the MSG, MSGLOG and MSGSTREAM macros.

Member Typedef Documentation

◆ level_t

Constructor & Destructor Documentation

◆ LogStream()

Logger::LogStream::LogStream ( const std::string &  logname,
const level_t &  sev,
const char *  file = 0,
int  line = -1 
)

Store the logger name, level and source location; ok() starts as LOGGER.logging(sev).

◆ ~LogStream()

virtual Logger::LogStream::~LogStream ( )
inlinevirtual

Pass the collected text to LOGGER.log() as a LogRecord.

This happens whether or not the level is enabled; the macros check the level before creating the stream.

Member Function Documentation

◆ file()

const char * Logger::LogStream::file ( ) const
inline

Return the source file name given to the constructor.

◆ finish()

void Logger::LogStream::finish ( )
inline

Set ok() to false; MSGSTREAM uses this to end its one-pass loop.

◆ line()

const int Logger::LogStream::line ( ) const
inline

Return the source line given to the constructor.

◆ logger_ostream()

std::ostream & Logger::LogStream::logger_ostream ( )
inline

Return this stream as a std::ostream reference.

◆ ok()

bool Logger::LogStream::ok ( ) const
inline

get the state of the stream


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