Dv::Util::logstream Class Reference

A logstream is an ostream useful for logging. More...

#include <logstream.h>

Collaboration diagram for Dv::Util::logstream:
Collaboration graph
[legend]

List of all members.

Classes

class  LogFilter
 Implements Filter interface for filterstreambuf. More...

Public Member Functions

 logstream (const std::string &path, const std::string &prefix)
 Creates ofstream for path.
 logstream (std::ostream &stream, const std::string &prefix)
 Constructor.
 ~logstream ()
 Destructor.
const std::string & prefix () const
void prefix (const std::string &s)

Private Attributes

LogFilter filter_

Detailed Description

A logstream is an ostream useful for logging.

Each line is preceeded by the date and an application-determined identification string.

Warning:
Output is line-oriented and buffered, i.e. output will be kept until '\n' is seen, at which time the whole line (preceeded by prefix and date information) will be written to the output.

Definition at line 29 of file logstream.h.


Constructor & Destructor Documentation

Dv::Util::logstream::logstream ( const std::string &  path,
const std::string &  prefix 
)

Creates ofstream for path.

The stream will be opened with mode ios:app, i.e. a seek to the end of the stream will be performed before each output operation.

Parameters:
path on which log output will be written.
prefix each output line will start with the date and this prefix string
See also:
Dv::Util::Date
Dv::Util::logstream::logstream ( std::ostream &  stream,
const std::string &  prefix 
)

Constructor.

Parameters:
stream existing stream on which output will be written.
prefix each output line will start with the date and this prefix string
Dv::Util::logstream::~logstream (  ) 

Destructor.


Member Function Documentation

const std::string& Dv::Util::logstream::prefix (  )  const [inline]
Returns:
current prefix that is put at the start of each line.
See also:
Dv::Util::logstream::logstream

Definition at line 117 of file logstream.h.

References filter_, and Dv::Util::logstream::LogFilter::prefix().

void Dv::Util::logstream::prefix ( const std::string &  s  )  [inline]
Parameters:
s prefix that is put at the start of each line.
See also:
Dv::Util::logstream::logstream

Definition at line 122 of file logstream.h.

References filter_, and Dv::Util::logstream::LogFilter::prefix().


Member Data Documentation

Definition at line 124 of file logstream.h.

Referenced by prefix().


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

dvutil-1.0.10 [ 5 December, 2009]