ost::Slog(3) | Library Functions Manual | ost::Slog(3) |
NAME¶
ost::Slog - The slog class is used to stream messages to the system's logging facility (syslogd).SYNOPSIS¶
#include <slog.h>Public Types¶
enum Class { classSecurity, classAudit, classDaemon, classUser, classDefault, classLocal0, classLocal1, classLocal2, classLocal3, classLocal4, classLocal5, classLocal6, classLocal7 }
Public Member Functions¶
Slog (void)
Protected Member Functions¶
int overflow (int c)
Detailed Description¶
The slog class is used to stream messages to the system's logging facility (syslogd).slog('mydaemon', SLOG_DAEMON, SLOG_EMERGENCY) << I just died << endl;or things like:
slog('mydaemon', SLOG_DAEMON); slog(SLOG_INFO) << 'daemon initalized' << endl;The intent is to be as common-place and as convenient to use as the stderr based clog facility found in C++, and this is especially useful for C++ daemons. The std::flush manipulator doesn't work. Either the std::endl or std::ends manipulators must be used to cause the output to be sent to the daemon. When this class is used on a system that doesn't have the syslog headers (i.e. a non-posix win32 box), the output goes to the a file with the same name as the syslog identifier string with '.log' appended to it. If the identifier string ends in '.exe', the '.exe' is removed before the '.log' is appened. (e.g. the identifier foo.exe will generate a log file named foo.log) Author:
David Sugar dyfet@ostel.com
Minor docs & hacks by Jon Little littlej@arlut.utexas.edu
system logging facility class.
Member Typedef Documentation¶
typedef enum ost::Slog::Class ost::Slog::Class¶
typedef enum ost::Slog::Level ost::Slog::Level¶
Member Enumeration Documentation¶
enum ost::Slog::Class¶
Enumerator:- classSecurity
- classAudit
- classDaemon
- classUser
- classDefault
- classLocal0
- classLocal1
- classLocal2
- classLocal3
- classLocal4
- classLocal5
- classLocal6
- classLocal7
-
enum ost::Slog::Level¶
Enumerator:- levelEmergency
- levelAlert
- levelCritical
- levelError
- levelWarning
- levelNotice
- levelInfo
- levelDebug
-
Constructor & Destructor Documentation¶
ost::Slog::Slog (void)¶
Default (and only) constructor. The default log level is set to SLOG_DEBUG. There is no default log facility set. One should be set before attempting any output. This is done by the open() or the operator()(const char*, Class, Level) functions.virtual ost::Slog::~Slog (void) [virtual]¶
Member Function Documentation¶
void ost::Slog::alert (const char *format, ...)¶
Print a formatted syslog string. Parameters:format string.
Slog& ost::Slog::alert (void) [inline]¶
References levelAlert.void ost::Slog::clogEnable (boolf = true) [inline]¶
Enables or disables the echoing of the messages to clog in addition to the syslog daemon. This is enabled by the default class constructor. Parameters:f true to enable, false to disable clog
output
slogTest.cpp.
void ost::Slog::close (void)¶
void ost::Slog::critical (const char *format, ...)¶
Print a formatted syslog string. Parameters:format string.
Slog& ost::Slog::critical (void) [inline]¶
References levelCritical.void ost::Slog::debug (const char *format, ...)¶
Print a formatted syslog string. Parameters:format string.
Slog& ost::Slog::debug (void) [inline]¶
References levelDebug.void ost::Slog::emerg (const char *format, ...)¶
Print a formatted syslog string. Parameters:format string.
Slog& ost::Slog::emerg (void) [inline]¶
References levelEmergency.void ost::Slog::error (const char *format, ...)¶
Print a formatted syslog string. Parameters:format string.
Slog& ost::Slog::error (void) [inline]¶
References levelError.void ost::Slog::info (const char *format, ...)¶
Print a formatted syslog string. Parameters:format string.
Slog& ost::Slog::info (void) [inline]¶
References levelInfo.void ost::Slog::level (Levelenable) [inline]¶
Sets the logging level. Parameters:enable is the logging level to use for
further output
void ost::Slog::notice (const char *format, ...)¶
Print a formatted syslog string. Parameters:format string.
Slog& ost::Slog::notice (void) [inline]¶
References levelNotice.void ost::Slog::open (const char *ident, Classgrp = classUser )¶
(re)opens the output stream. Parameters:ident The identifier portion of the
message sent to the syslog daemon.
grp The log facility the message is sent to
Slog& ost::Slog::operator() (const char *ident, Classgrp = classUser, Levellevel = levelError )¶
Sets the log identifier, level, and class to use for subsequent output. Parameters:ident The identifier portion of the
message
grp The log facility the message is sent to
level The log level of the message
Slog& ost::Slog::operator() (Levellevel, Classgrp = classDefault)¶
Changes the log level and class to use for subsequent output. Parameters:level The log level of the message
grp The log facility the message is sent to
Slog& ost::Slog::operator() (void)¶
Does nothing except return *this.int ost::Slog::overflow (intc) [protected]¶
This is the streambuf function that actually outputs the data to the device. Since all output should be done with the standard ostream operators, this function should never be called directly.void ost::Slog::warn (const char *format, ...)¶
Print a formatted syslog string. Parameters:format string.
Slog& ost::Slog::warn (void) [inline]¶
References levelWarning.Author¶
Generated automatically by Doxygen for GNU CommonC++ from the source code.Sat Jun 23 2012 | GNU CommonC++ |