#include <log.h>
Inheritance diagram for utils::logging::ostream_listener::
Public Methods | |
ostream_listener (ostream &o=cerr) | |
~ostream_listener () | |
bool | onMsg (const msg &msg) |
handles a individual message. More... | |
Public Attributes | |
ostream & | out |
This class provides an implementation that writes the message onto an ostream.
Note that using this class is just a quick and dirty solution. It is not thread-safe in that if you use it with std::cerr or std::cout there is no way to synchronize accesses with other threads. On the other hand you cannot use it like these:
int main() { ... // will crash!! after destruction of out ofstream out(filename); new ostream_listener(out); ... // will never close the outfile. new ostream_listener(new ofstream(filename)); ... }
|
|
|
|
|
handles a individual message. If this method returns false the message won't be handled any longer. As listener base objects are called in the order of creation you might use this to create simple message filters. Reimplemented from utils::logging::listener. |
|
|