senf::log::SyslogTarget Class Reference

Log target writing to the syslog. More...

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

Inheritance diagram for senf::log::SyslogTarget:

Public Types

enum  LogFacility {
  AUTHPRIV = LOG_AUTHPRIV, CRON = LOG_CRON, DAEMON = LOG_DAEMON, FTP = LOG_FTP,
  KERN = LOG_KERN, LOCAL0 = LOG_LOCAL0, LOCAL1 = LOG_LOCAL1, LOCAL2 = LOG_LOCAL2,
  LOCAL3 = LOG_LOCAL3, LOCAL4 = LOG_LOCAL4, LOCAL5 = LOG_LOCAL5, LOCAL6 = LOG_LOCAL6,
  LOCAL7 = LOG_LOCAL7, LPR = LOG_LPR, MAIL = LOG_MAIL, NEWS = LOG_NEWS,
  SYSLOG = LOG_SYSLOG, USER = LOG_USER, UUCP = LOG_UUCP
}
 
- 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
 

Static Public Attributes

static int const LEVELMAP [8]
 

Structors and default members

 SyslogTarget (int facility=LOG_USER)
 

Additional Inherited Members

- 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...
 

Detailed Description

Log target writing to the syslog.

The SyslogTarget will send all log messages to the syslog at the given facility.

// Route all messages to the syslog
syslog.route();
    Valid facility values (taken from <tt>man 3 syslog</tt>):
    \par ""
       <tt>LOG_AUTHPRIV</tt>, <tt>LOG_CRON</tt>, <tt>LOG_DAEMON</tt>, <tt>LOG_FTP</tt>,
       <tt>LOG_KERN</tt>, <tt>LOG_LOCAL0</tt>, <tt>LOG_LOCAL1</tt>, <tt>LOG_LOCAL2</tt>,
       <tt>LOG_LOCAL3</tt>, <tt>LOG_LOCAL4</tt>, <tt>LOG_LOCAL5</tt>, <tt>LOG_LOCAL6</tt>,
       <tt>LOG_LOCAL7</tt>, <tt>LOG_LPR</tt>, <tt>LOG_MAIL</tt>, <tt>LOG_NEWS</tt>,
       <tt>LOG_SYSLOG</tt>, <tt>LOG_USER</tt>, <tt>LOG_UUCP</tt>

    The default facility is <tt>LOG_USER</tt>.

    The SENF log levels are mapped to syslog levels in the following way:

    <table class="senf fixedcolumn">
    <tr><td>senf::log::VERBOSE</td>   <td>\c LOG_DEBUG</td></tr>
    <tr><td>senf::log::NOTICE</td>    <td>\c LOG_INFO</td></tr>
    <tr><td>senf::log::MESSAGE</td>   <td>\c LOG_NOTICE</td></tr>
    <tr><td>senf::log::IMPORTANT</td> <td>\c LOG_WARNING</td></tr>
    <tr><td>senf::log::CRITICAL</td>  <td>\c LOG_CRIT</td></tr>
    <tr><td>senf::log::FATAL</td>     <td>\c LOG_EMERG</td></tr>
    </table>

Definition at line 68 of file SyslogTarget.hh.

Member Enumeration Documentation

◆ LogFacility

Enumerator
AUTHPRIV 
CRON 
DAEMON 
FTP 
KERN 
LOCAL0 
LOCAL1 
LOCAL2 
LOCAL3 
LOCAL4 
LOCAL5 
LOCAL6 
LOCAL7 
LPR 
MAIL 
NEWS 
SYSLOG 
USER 
UUCP 

Definition at line 91 of file SyslogTarget.hh.

Constructor & Destructor Documentation

◆ SyslogTarget()

senf::log::SyslogTarget::SyslogTarget ( int  facility = LOG_USER)
explicit

Member Data Documentation

◆ LEVELMAP

int const senf::log::SyslogTarget::LEVELMAP
static
Initial value:
= {
0, LOG_DEBUG, LOG_INFO, LOG_NOTICE, LOG_WARNING, LOG_CRIT, LOG_EMERG, 0 }

Definition at line 89 of file SyslogTarget.hh.


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