23#include <piduino/flags.h>
24#include <piduino/global.h>
195 void log (
const char *format, ...);
198 (void) setlogmask (LOG_MASK (p));
202 (void) setlogmask (LOG_UPTO (p));
206 return setlogmask (0);
282 return { __priority };
285 inline std::ostream &
A type-safe flags class for bitwise operations on enum values.
void setPriority(const int priority)
SysLogBuffer(int priority)
static std::string priorityName(Priority p)
Name of a priority.
Option option() const
Reads the current option flags.
static void cerrToSyslog()
redirect std::cerr to the system logger
void log(Priority p, const char *format,...)
Generates a log message.
Flags< OptionFlag > Option
void open(const char *ident, const SysLog::Facility &facility, const SysLog::Option &option)
std::string priorityName() const
Priority
importance of the message
@ Notice
normal, but significant, condition
@ Alert
action must be taken immediately
@ Critical
critical conditions
@ Debug
debug-level message
@ Emergency
system is unusable
@ Info
informational message
@ Warning
warning conditions
std::string facilityName() const
Name of the current facility.
SysLog(Priority initialPrio=Info)
Constructor.
Priority priority() const
OptionFlag
The option argument specifies flags which control the operation of open() and subsequent calls to log...
@ Pid
Include PID with each message.
@ Perror
(Not in POSIX.1-2001 or POSIX.1-2008.) Print to stderr as well.
@ Console
Write directly to system console if there is an error while sending to system logger.
@ Delay
The converse of LOG_NDELAY; opening of the connection is delayed until syslog() is called....
@ NoDelay
Open the connection immediately (normally, the connection is opened when the first message is logged)...
@ NoWait
Don't wait for child processes that may have been created while logging the message....
Facility facility() const
Reads the current facility.
static void coutToSyslog()
redirect std::cout to the system logger
void open(const std::string &ident, const SysLog::Facility &facility=User, const SysLog::Option &option=Pid)
Opens a connection to the system logger.
void log(const char *format,...)
Generates a log message This is an overloaded member function, provided for convenience....
bool is_open() const
Returns whether the object is currently associated to the system logger.
void setPriority(Priority p=Info)
void close()
closes the descriptor being used to write to the system logger.
static std::string facilityName(const Facility &facility)
Name of a facility.
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 convenien...
Facility
The facility argument is used to specify what type of program is logging the message....
@ Local7
reserved for local use
@ Local4
reserved for local use
@ User
(default) generic user-level messages
@ Kernel
kernel messages (these can't be generated from user processes)
@ Local5
reserved for local use
@ Syslogd
messages generated internally by syslogd(8)
@ Daemon
system daemons without separate facility value
@ Lpr
line printer subsystem
@ Local3
reserved for local use
@ Auth
security/authorization messages
@ Local6
reserved for local use
@ News
USENET news subsystem.
@ Local2
reserved for local use
@ AuthPriv
security/authorization messages (private)
@ Cron
clock daemon (cron and at)
@ Local1
reserved for local use
@ Local0
reserved for local use
void setMaskUpTo(Priority p)
Global namespace for Piduino.
SysLog Syslog
Piduino SysLog Global Object.
_Setpriority setpriority(SysLog::Priority __priority)
static std::ostream & operator<<(std::ostream &out, const OptionParser &op)