Dv::Thread::logstream::LogFilter Class Reference
Implements Filter interface for filterstreambuf.
More...
List of all members.
Public Member Functions |
| LogFilter (const std::string &path, const std::string &prefix) |
| Constructor.
|
| LogFilter (std::ostream &stream, const std::string &prefix) |
| Constructor, stream is managed by client.
|
| ~LogFilter () |
| Destructor.
|
int | put (int c) |
| Output a character.
|
int | get () |
| Input a character, always fails.
|
int | sync () |
| Flush buffers.
|
void | close () |
| This is a noop.
|
void | prefix (const std::string &prefix) |
| Set prefix that will be printed at the start of each output line.
|
const std::string & | prefix () const |
std::ios::iostate | state () const |
Private Attributes |
bool | owner_ |
| True if stream was created from a path.
|
std::map< pthread_t, std::string > | buffers_ |
| Each running thread has its own buffer.
|
std::string | prefix_ |
std::ostream * | stream_ |
bool | lastnl_ |
Detailed Description
Implements Filter interface for filterstreambuf.
Constructor & Destructor Documentation
Dv::Thread::logstream::LogFilter::LogFilter |
( |
const std::string & |
path, |
|
|
const std::string & |
prefix | |
|
) |
| | |
Constructor.
- Parameters:
-
| path | name of file on which log will be written. |
| prefix,: | each output line will start with the current date, the id of the writing thread and the prefix string |
- See also:
- Dv::Util::Date
Dv::Thread::logstream::LogFilter::LogFilter |
( |
std::ostream & |
stream, |
|
|
const std::string & |
prefix | |
|
) |
| | |
Constructor, stream is managed by client.
- Parameters:
-
| stream | open output stream on which log will be written. |
| prefix,: | each output line will start with the current date, the id of the writing thread and the prefix string |
- See also:
- Dv::Util::Date
Dv::Thread::logstream::LogFilter::~LogFilter |
( |
|
) |
|
Member Function Documentation
int Dv::Thread::logstream::LogFilter::put |
( |
int |
c |
) |
|
Output a character.
- Parameters:
-
- Returns:
- c is all went well, EOF otherwise.
int Dv::Thread::logstream::LogFilter::get |
( |
|
) |
[inline] |
Input a character, always fails.
- Returns:
- EOF, this is an output-only filter.
int Dv::Thread::logstream::LogFilter::sync |
( |
|
) |
|
Flush buffers.
- Returns:
- 0 if ok, EOF otherwise
void Dv::Thread::logstream::LogFilter::close |
( |
|
) |
[inline] |
void Dv::Thread::logstream::LogFilter::prefix |
( |
const std::string & |
prefix |
) |
[inline] |
const std::string& Dv::Thread::logstream::LogFilter::prefix |
( |
|
) |
const [inline] |
std::ios::iostate Dv::Thread::logstream::LogFilter::state |
( |
|
) |
const |
- Returns:
- iostate of underlying stream
Member Data Documentation
Each running thread has its own buffer.
The documentation for this class was generated from the following file: