A Dv::Thread::logstream is an ostream useful for logging. More...
#include <logstream.h>
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) |
Set prefix. | |
Private Attributes | |
LogFilter | filter_ |
A Dv::Thread::logstream is an ostream useful for logging.
Each line is preceeded by the date, the id of the writing thread, and an application-determined identification string.
t1<t2
is well-defined for two pthread_t values t1
and t2
. Dv::Thread::logstream::logstream | ( | const std::string & | path, | |
const std::string & | prefix | |||
) |
Creates ofstream for path.
The stream will be opened with mode std::ios::app, i.e. a seek to the end of the stream will be performed before each output operation.
path | on which log output will be written. | |
prefix | each output line will start with the date, the id of the writing thread and this prefix string |
Dv::Thread::logstream::logstream | ( | std::ostream & | stream, | |
const std::string & | prefix | |||
) |
Constructor.
stream | existing stream on which output will be written. | |
prefix | each output line will start with the date and this prefix string |
Dv::Thread::logstream::~logstream | ( | ) |
Destructor.
const std::string& Dv::Thread::logstream::prefix | ( | ) | const [inline] |
References filter_, and Dv::Thread::logstream::LogFilter::prefix().
void Dv::Thread::logstream::prefix | ( | const std::string & | s | ) | [inline] |
Set prefix.
s | prefix that is put at the start of each line. |
References filter_, and Dv::Thread::logstream::LogFilter::prefix().
LogFilter Dv::Thread::logstream::filter_ [private] |
Referenced by prefix().
dvthread-0.13.4 | [11 December, 2009] |