ModErn Text Analysis
META Enumerates Textual Applications
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
meta::logging::logger::log_line Class Reference

log_line: Represents a single message to be written to all sinks. More...

#include <logger.h>

Public Member Functions

 log_line (logger &log, severity_level sev, size_t line, const std::string &file)
 Constructs a new log line for the given logger. More...
 
log_lineoperator<< (log_line &(*fn)(log_line &))
 Overloaded operator<<(), used to determine when a manipulator is sent to the log_line stream. More...
 
template<class T >
log_lineoperator<< (const T &to_write)
 Generic operator<<(). More...
 
void write_to_sinks ()
 Writes the current log line to all sinks of the logger it was created with.
 
std::string str () const
 Converts the internal stream to a string. More...
 
severity_level severity () const
 
const std::string & file () const
 
size_t line () const
 

Static Public Member Functions

static log_lineendlg (log_line &logline)
 Simulates a std::endl, but for log entries. More...
 

Private Attributes

std::stringstream stream_
 Internal stream.
 
loggerlog_
 The logger this log_line is to be written on.
 
severity_level sev_
 The severity of this message.
 
size_t line_
 The line number for this message.
 
std::string file_
 The file for this message.
 

Detailed Description

log_line: Represents a single message to be written to all sinks.

Constructor & Destructor Documentation

meta::logging::logger::log_line::log_line ( logger log,
severity_level  sev,
size_t  line,
const std::string &  file 
)
inline

Constructs a new log line for the given logger.

Parameters
logThe logger this message was created for
sevThe severity of this message
lineThe line number for this message
fileThe file for this message

Member Function Documentation

static log_line& meta::logging::logger::log_line::endlg ( log_line logline)
inlinestatic

Simulates a std::endl, but for log entries.

Flushes all internal streams and then writes the log_line to all sinks of the log object it was created with.

Parameters
loglineThe log line to be flushed to all sinks
Returns
the log line given
log_line& meta::logging::logger::log_line::operator<< ( log_line &(*)(log_line &)  fn)
inline

Overloaded operator<<(), used to determine when a manipulator is sent to the log_line stream.

Parameters
fnA function pointer sent to the stream.
Returns
the current log_line, for chaining
template<class T >
log_line& meta::logging::logger::log_line::operator<< ( const T &  to_write)
inline

Generic operator<<().

Simply writes the given data to the internal stream.

Parameters
to_writeThe data to be written.
Returns
the current log_line, for chaining
std::string meta::logging::logger::log_line::str ( ) const
inline

Converts the internal stream to a string.

Returns
the string for this log_line
severity_level meta::logging::logger::log_line::severity ( ) const
inline
Returns
the severity of this log_line
const std::string& meta::logging::logger::log_line::file ( ) const
inline
Returns
the file for this log_line
size_t meta::logging::logger::log_line::line ( ) const
inline
Returns
the line number for this log_line

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