plumbing::logging Class Reference

#include <logging.h>

Inheritance diagram for plumbing::logging:
plumbing::logging_file plumbing::logging_null plumbing::logging_stderr plumbing::logging_syslog plumbing::logging_tee

Public Member Functions

virtual ~logging ()
void warning (const char *fmt,...) FORMAT_PRINTF(2
void void warning_v (const char *fmt, va_list ap) FORMAT_PRINTF(2
void void void fatal_error (const char *fmt,...) FORMAT_PRINTF(2
void void void void fatal_error_v (const char *fmt, va_list ap) FORMAT_PRINTF(2
void message (const char *fmt,...) FORMAT_PRINTF(2
void void message_v (const char *fmt, va_list ap) FORMAT_PRINTF(2

Static Public Member Functions

void void void void static
logging
get_singleton ()
static void register_stream (logging *ls)

Protected Member Functions

 logging ()
virtual void deliver_message_text (const char *txt)=0
void exit ()

Private Member Functions

 logging (const logging &)
loggingoperator= (const logging &)

Static Private Attributes

static loggingsingleton

Friends

class logging_tee

Detailed Description

The logging class is used to represent an abstract logging destination. It could be a log file, or it could be syslog, or it could be the standard error stream.

Usage: If you do not instantiate a logging instance, a stderr instance will be created at run time.

If you want something other than the standard error stream, use the logging::register_stream class method to direct the logging output elsewhere.

logging::register_stream(new logging_file("gwen"));

Note that this must be done very early in your program's lifetime.

Definition at line 43 of file logging.h.


Constructor & Destructor Documentation

plumbing::logging::~logging (  )  [virtual]

The destructor.

Definition at line 30 of file logging.cc.

plumbing::logging::logging (  )  [protected]

The default constructor.

Notice that this constructor is protected. This is because you must derive from this class in order to create a meaningful logging mechanism.

Definition at line 37 of file logging.cc.

plumbing::logging::logging ( const logging  )  [private]

The copy constructor. Do not use.


Member Function Documentation

virtual void plumbing::logging::deliver_message_text ( const char *  txt  )  [protected, pure virtual]

The deliver_message_text method is used to actually deliver a log message to the logging medium. All formatting has been completed, the text requires no further substitutions.

Implemented in plumbing::logging_file, plumbing::logging_null, plumbing::logging_stderr, plumbing::logging_syslog, and plumbing::logging_tee.

void plumbing::logging::exit (  )  [protected]

The exit method is used to terminate the execution of the program. The exit status will be one (1).

Note:
This method does not return.

Definition at line 101 of file logging.cc.

void plumbing::logging::fatal_error ( const char *  fmt,
  ... 
)

The fatal_error method may be used to log a fatal error. The message is delivered via the message_v virtual method. Program execution is terminated via the exit method.

Parameters:
fmt The format of the message, which also describes all of the following arguments. See printf(3) for more information.

Definition at line 81 of file logging.cc.

void plumbing::logging::fatal_error_v ( const char *  fmt,
va_list  ap 
)

The fatal_error_v method may be used to log a fatal error. The message is delivered via the message_v virtual method. Program execution is terminated via the exit method.

Parameters:
fmt The format of the message.
ap the rest of the format's arguments. See vprintf(3) for more information.

Definition at line 91 of file logging.cc.

plumbing::logging & plumbing::logging::get_singleton (  )  [static]

The get_singleton class method is used to obtain a reference to the sole logging instance for the system. See the log() function, below, for how it is used.

Definition at line 115 of file logging.cc.

void plumbing::logging::message ( const char *  fmt,
  ... 
)

The message method is used to format and a print a log message.

Parameters:
fmt The format of the message, which also describes all of the following arguments. See printf(3) for more information.

Definition at line 43 of file logging.cc.

void plumbing::logging::message_v ( const char *  fmt,
va_list  ap 
)

The message_v method may be used to format and print a log message. The message text is delivered via the deliver_message_text method.

Parameters:
fmt The format of the message.
ap The rest of the format's arguments. See vprintf(3) for more information.

Definition at line 53 of file logging.cc.

logging& plumbing::logging::operator= ( const logging  )  [private]

The assignment operator. Do not use.

void plumbing::logging::register_stream ( logging ls  )  [static]

The register_stream class method is used to redirect logging into a different logging stream.

Definition at line 108 of file logging.cc.

void plumbing::logging::warning ( const char *  fmt,
  ... 
)

The warning method may be used to log a warning. The message is delivered via the message_v virtual method.

Parameters:
fmt The format of the message, which also describes all of the following arguments. See printf(3) for more information.

Definition at line 62 of file logging.cc.

void plumbing::logging::warning_v ( const char *  fmt,
va_list  ap 
)

The warning_v method may be used to log a warning. The message is delivered via the message_v virtual method.

Parameters:
fmt The format of the message.
ap the rest of the format's arguments. See vprintf(3) for more information.

Definition at line 72 of file logging.cc.


Friends And Related Function Documentation

friend class logging_tee [friend]

Definition at line 181 of file logging.h.


Field Documentation

The singleton class variable is used to remember the address of the sole instance of the logging destination.

Definition at line 167 of file logging.h.


The documentation for this class was generated from the following files:
Generated on Thu Sep 16 14:51:27 2010 for Plumbing by  doxygen 1.6.3