Write log messages to arbitrary std::ostream. More...
#include <senf/Utils/Logger/IOStreamTarget.hh>
Public Member Functions | |
std::ostream & | stream () const |
void | stream (std::ostream &newos) |
![]() | |
iterator | begin () const |
Iterator to beginning of routing table. More... | |
iterator | end () const |
Iterator past the end of routing table. More... | |
RoutingEntry const & | operator[] (size_type i) const |
Access routing entry. More... | |
size_type | size () const |
Number of routing table entries. More... | |
bool | empty () const |
true , if routing table empty, false otherwise More... | |
void | flush () |
Clear routing table. More... | |
senf::console::ScopedDirectory & | consoleDir () |
Get console/config directory. More... | |
Target (std::string const &name) | |
virtual | ~Target () |
template<class Stream , class Area , class Level > | |
void | route (action_t action=ACCEPT, int index=-1) |
Add route (static) More... | |
void | route (std::string const &stream, std::string const &area="", unsigned level=NONE::value, action_t action=ACCEPT, int index=-1) |
Add route (dynamic) More... | |
template<class Stream , class Area , class Level > | |
void | unroute (action_t action=ACCEPT) |
Remove route (static) More... | |
void | unroute (std::string const &stream, std::string const &area="", unsigned level=NONE::value, action_t action=ACCEPT) |
Remove route (dynamic) More... | |
void | unroute (int index=-1) |
Remove route (indexed) More... | |
Protected Member Functions | |
void | v_write (time_type timestamp, std::string const &stream, std::string const &area, unsigned level, std::string const &message) |
Called to write out the routing message. More... | |
Structors and default members | |
IOStreamTarget (std::string const &name, std::ostream &os) | |
Additional Inherited Members | |
![]() | |
enum | action_t { ACCEPT, REJECT } |
Routing action. More... | |
typedef RIB::const_iterator | iterator |
Routing table iterator. More... | |
typedef RIB::size_type | size_type |
![]() | |
std::ostream & | operator<< (std::ostream &os, Target::action_t const &action) |
Write route action. More... | |
Write log messages to arbitrary std::ostream.
This target will write log messages to an arbitrary std::ostream in the format
<date> [<level>][<area>] <message>
The area will be omitted if it is senf::log::DefaultArea
.
Definition at line 41 of file IOStreamTarget.hh.
senf::log::IOStreamTarget::IOStreamTarget | ( | std::string const & | name, |
std::ostream & | os | ||
) |
std::ostream& senf::log::IOStreamTarget::stream | ( | ) | const |
void senf::log::IOStreamTarget::stream | ( | std::ostream & | newos | ) |
|
protectedvirtual |
Called to write out the routing message.
This member must be defined in the derived class to somehow format and write the log message.
Every log message always possesses a complete set of meta information (stream, area and level).
[in] | timestamp | log message timing information |
[in] | stream | message stream |
[in] | area | message area |
[in] | level | message level |
[in] | message | the message string |
Implements senf::log::Target.
Definition at line 31 of file IOStreamTarget.cc.