#include <slog.h>
Inheritance diagram for Slog::
Public Methods | |
Slog () | |
virtual | ~Slog () |
int | overflow (int c) |
void | close (void) |
void | open (const char *ident, slog_class_t grp=SLOG_USER) |
Slog & | operator() (const char *ident, slog_class_t grp=SLOG_USER, slog_level_t level=SLOG_ERROR) |
Slog & | operator() (slog_level_t level, slog_class_t=SLOG_DEFAULT) |
Slog & | operator() (void) |
void | level (slog_level_t enable) |
A default slog
object is used to avoid confusion with the native syslog fascility and to imply a logical relationship to the C++ clog()
.
The key difference is that the slog
object sends it's output to the system logging daemon (typically syslogd) rather than through stderr. slog
can be streamed with the <<
operator just like clog
; a default slog object is pre-initialized, and you stream character data to it.
The slog
allows one to specify logging levels and other properties through the ()
operators. Hence, once can do:
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|