![]() |
PIDUINO
|
#include <syslog.h>
Public Types | |
enum | Priority { Emergency = LOG_EMERG , Alert = LOG_ALERT , Critical = LOG_CRIT , Error = LOG_ERR , Warning = LOG_WARNING , Notice = LOG_NOTICE , Info = LOG_INFO , Debug = LOG_DEBUG , NoPriority = -1 } |
importance of the message More... | |
enum | Facility { Auth = LOG_AUTH , AuthPriv = LOG_AUTHPRIV , Cron = LOG_CRON , Daemon = LOG_DAEMON , Ftp = LOG_FTP , Kernel = 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 , Syslogd = LOG_SYSLOG , User = LOG_USER , Uucp = LOG_UUCP , NoFacility = -1 } |
The facility argument is used to specify what type of program is logging the message. This lets the configuration file specify that messages from different facilities will be handled differently. More... | |
enum | OptionFlag { Console = LOG_CONS , NoDelay = LOG_NDELAY , NoWait = LOG_NOWAIT , Delay = LOG_ODELAY , Perror = LOG_PERROR , Pid = LOG_PID , NoOption = 0 } |
The option argument specifies flags which control the operation of open() and subsequent calls to log() More... | |
typedef Flags< OptionFlag > | Option |
Public Member Functions | |
SysLog (Priority initialPrio=Info) | |
Constructor. | |
~SysLog () | |
Destructor. | |
void | open (const std::string &ident, const SysLog::Facility &facility=User, const SysLog::Option &option=Pid) |
Opens a connection to the system logger. | |
void | open (const SysLog::Facility &facility=User, const SysLog::Option &option=Pid) |
Opens a connection to the system logger This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
bool | is_open () const |
Returns whether the object is currently associated to the system logger. | |
void | close () |
closes the descriptor being used to write to the system logger. | |
void | log (Priority p, const char *format,...) |
Generates a log message. | |
void | log (const char *format,...) |
Generates a log message This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | setMask (Priority p) |
void | setMaskUpTo (Priority p) |
int | mask () const |
void | setPriority (Priority p=Info) |
Priority | priority () const |
std::string | priorityName () const |
Facility | facility () const |
Reads the current facility. | |
std::string | facilityName () const |
Name of the current facility. | |
Option | option () const |
Reads the current option flags. | |
Static Public Member Functions | |
static std::string | priorityName (Priority p) |
Name of a priority. | |
static std::string | facilityName (const Facility &facility) |
Name of a facility. | |
static void | cerrToSyslog () |
redirect std::cerr to the system logger | |
static void | coutToSyslog () |
redirect std::cout to the system logger | |
Protected Member Functions | |
int | sync () |
void | setPriority (const int priority) |
Private Member Functions | |
void | open (const char *ident, const SysLog::Facility &facility, const SysLog::Option &option) |
Private Attributes | |
Option | m_option |
Facility | m_facility |
bool | m_isopen |
int | m_priority |
The facility argument is used to specify what type of program is logging the message. This lets the configuration file specify that messages from different facilities will be handled differently.
The option argument specifies flags which control the operation of open()
and subsequent calls to log()
importance of the message
This determines the importance of the message. The levels are, in order of decreasing importance
Constructor.
initialPrio | initial priority |
Piduino::SysLog::~SysLog | ( | ) |
Destructor.
|
static |
redirect std::cerr to the system logger
void Piduino::SysLog::close | ( | ) |
closes the descriptor being used to write to the system logger.
The use of close() is optional.
|
static |
redirect std::cout to the system logger
|
inline |
Reads the current facility.
The facility argument is used to specify what type of program is logging the message. This lets the configuration file specify that messages from different facilities will be handled differently.
Definition at line 228 of file syslog.h.
References m_facility.
Referenced by facilityName().
|
inline |
Name of the current facility.
Definition at line 236 of file syslog.h.
References facility(), and facilityName().
Referenced by facilityName().
|
static |
Name of a facility.
|
inline |
void Piduino::SysLog::log | ( | const char * | format, |
... | |||
) |
Generates a log message This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Piduino::SysLog::log | ( | Priority | p, |
const char * | format, | ||
... | |||
) |
Generates a log message.
The priority argument is formed by ORing the facility and the level values (explained below). The remaining arguments are a format, as in printf(3) and any arguments required by the format, except that the two character sequence m will be replaced by the error message string strerror(errno). A trailing newline may be added if needed.
|
private |
void Piduino::SysLog::open | ( | const std::string & | ident, |
const SysLog::Facility & | facility = User , |
||
const SysLog::Option & | option = Pid |
||
) |
Opens a connection to the system logger.
The string pointed to by ident is prepended to every message, and is typically set to the program name.
void Piduino::SysLog::open | ( | const SysLog::Facility & | facility = User , |
const SysLog::Option & | option = Pid |
||
) |
Opens a connection to the system logger This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
|
inline |
Definition at line 213 of file syslog.h.
References Piduino::SysLogBuffer::priority().
Referenced by priorityName().
|
inline |
Definition at line 217 of file syslog.h.
References priority(), and priorityName().
Referenced by priorityName().
|
static |
Name of a priority.
|
protectedinherited |
Referenced by setPriority().
Definition at line 209 of file syslog.h.
References Piduino::SysLogBuffer::setPriority().
Referenced by Piduino::operator<<().
|
protectedinherited |
|
private |
Definition at line 269 of file syslog.h.
Referenced by facility().
|
private |
|
private |
|
privateinherited |
Definition at line 58 of file syslog.h.
Referenced by Piduino::SysLogBuffer::priority().