Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Slog Class Reference

The slog class is used to stream messages to the system logging fascility. system logging fascility class. More...

#include <slog.h>

Inheritance diagram for Slog::

std::streambuf std::ostream List of all members.

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)

Detailed Description

The slog class is used to stream messages to the system logging fascility. system logging fascility class.

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.

Author:
David Sugar <dyfet@ostel.com>


Constructor & Destructor Documentation

Slog::Slog (    ) 
 

virtual Slog::~Slog (    )  [virtual]
 


Member Function Documentation

void Slog::close (  void   ) 
 

void Slog::level (  slog_level_t   enable )  [inline]
 

void Slog::open (  const char *   ident,
slog_class_t   grp = SLOG_USER
) 
 

Slog& Slog::operator() (  void   ) 
 

Slog& Slog::operator() (  slog_level_t   level,
slog_class_t   = SLOG_DEFAULT
) 
 

Slog& Slog::operator() (  const char *   ident,
slog_class_t   grp = SLOG_USER,
slog_level_t   level = SLOG_ERROR
) 
 

int Slog::overflow (  int   c ) 
 


The documentation for this class was generated from the following file:
Generated at Tue Nov 20 12:34:36 2001 for CommonC++ by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001