Nevelex Corporation Nevelex Utilities 1.1.4 09/06/2003
Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

nevelex_util::SyslogLogger Class Reference

#include <SyslogLogger.h>

Inheritance diagram for nevelex_util::SyslogLogger:

Inheritance graph
[legend]
Collaboration diagram for nevelex_util::SyslogLogger:

Collaboration graph
[legend]
List of all members.

Public Methods

 SyslogLogger (char *ident, int option=LOG_NDELAY|LOG_PID|LOG_CONS|LOG_PERROR, int facility=LOG_LOCAL0)
virtual ~SyslogLogger ()
virtual void log (LOGGING_LEVELS level, char *format,...)

Detailed Description

Logger implementation that sends logs to the UNIX syslog. By default, syslog messages are saved in /var/log/messages. This logging implementation does the same. However, you may also specify the facility for storage. By default, it is LOG_LOCAL0 (see syslog man page (3)). To store these messages in a different log file, append the following to /etc/syslog.conf and restart the syslog daemon:
		#
		# AFSPv2 Logging
		local0.*                                        /var/log/afsp.log
	
The previous example places all LOG_LOCAL0 facility messages in the file /var/log/afsp.log.

Author:
Michel Dalal


Constructor & Destructor Documentation

nevelex_util::SyslogLogger::SyslogLogger ( char * ident,
int option = LOG_NDELAY|LOG_PID|LOG_CONS|LOG_PERROR,
int facility = LOG_LOCAL0 )
 

Default constructor initalizes the syslog.

Parameters:
ident   string added to each log message.
option   list of logging parameters as defined by syslog man page (3). Defaults to logging pid, printing to stderr, openning the connection immediately and logging to the system console on logging errors.
facility   type of programming logging as defined by syslog man page (3). Defaults to LOG_LOCAL0.
Exceptions:
std::runtime_error   if ident is null.

nevelex_util::SyslogLogger::~SyslogLogger ( ) [virtual]
 

Default destructor uninits the syslog.


Member Function Documentation

void nevelex_util::SyslogLogger::log ( LOGGING_LEVELS level,
char * format,
... ) [virtual]
 

Add a log entry. WARNING: Log message must be less than 8096 bytes in length.

Parameters:
level   one of the enumeration values supplied in LOGGING_LEVELS enumeration.
format   a formatting string like that used by printf.
...   any arguments needed by the format string.

Reimplemented from nevelex_util::Logger.


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