senf::log::FileTarget Class Reference

Log target writing to a log file. More...

#include <senf/Utils/Logger/FileTarget.hh>

Inheritance diagram for senf::log::FileTarget:

Public Member Functions

void reopen ()
 Reopen log after log-file rotation. More...
 
void reopen (std::string const &file)
 Reopen log under a new name. More...
 
std::string const & filename () const
 Return current log file name. More...
 
- Public Member Functions inherited from senf::log::IOStreamTarget
std::ostream & stream () const
 
void stream (std::ostream &newos)
 
 IOStreamTarget (std::string const &name, std::ostream &os)
 
- Public Member Functions inherited from senf::log::Target
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::ScopedDirectoryconsoleDir ()
 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...
 

Structors and default members

 FileTarget (std::string const &filename, std::string const &nodename="")
 Construct FileTarget writing to file. More...
 

Additional Inherited Members

- Public Types inherited from senf::log::Target
enum  action_t { ACCEPT, REJECT }
 Routing action. More...
 
typedef RIB::const_iterator iterator
 Routing table iterator. More...
 
typedef RIB::size_type size_type
 
- Protected Member Functions inherited from senf::log::IOStreamTarget
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...
 

Detailed Description

Log target writing to a log file.

The FileTarget will save all log messages in the given file. Messages will be appended at the end of the file.

senf::log::FileTarget target ("file.name");
// Route all messages to this file.
target.route();
    After %log files have been rotated, the reopen() member should be called to create a new %log
    file.

Definition at line 52 of file FileTarget.hh.

Constructor & Destructor Documentation

◆ FileTarget()

senf::log::FileTarget::FileTarget ( std::string const &  filename,
std::string const &  nodename = "" 
)
explicit

Construct FileTarget writing to file.

Definition at line 46 of file FileTarget.cc.

Member Function Documentation

◆ filename()

std::string const & senf::log::FileTarget::filename ( ) const

Return current log file name.

Definition at line 86 of file FileTarget.cc.

◆ reopen() [1/2]

void senf::log::FileTarget::reopen ( )

Reopen log after log-file rotation.

Definition at line 70 of file FileTarget.cc.

◆ reopen() [2/2]

void senf::log::FileTarget::reopen ( std::string const &  file)

Reopen log under a new name.

Definition at line 76 of file FileTarget.cc.


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