#include <logging.h>
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 &) | |
| logging & | operator= (const logging &) |
Static Private Attributes | |
| static logging * | singleton |
Friends | |
| class | logging_tee |
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.
| virtual plumbing::logging::~logging | ( | ) | [virtual] |
The destructor.
| 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.
| plumbing::logging::logging | ( | const logging & | ) | [private] |
The copy constructor. Do not use.
| 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).
| void void 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.
| fmt | The format of the message, which also describes all of the following arguments. See printf(3) for more information. |
| void void void 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.
| fmt | The format of the message. | |
| ap | the rest of the format's arguments. See vprintf(3) for more information. |
| void void void void static 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.
| void plumbing::logging::message | ( | const char * | fmt, | |
| ... | ||||
| ) |
The message method is used to format and a print a log message.
| fmt | The format of the message, which also describes all of the following arguments. See printf(3) for more information. |
| void 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.
| fmt | The format of the message. | |
| ap | The rest of the format's arguments. See vprintf(3) for more information. |
The assignment operator. Do not use.
| static void plumbing::logging::register_stream | ( | logging * | ls | ) | [static] |
The register_stream class method is used to redirect logging into a different logging stream.
| 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.
| fmt | The format of the message, which also describes all of the following arguments. See printf(3) for more information. |
| void 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.
| fmt | The format of the message. | |
| ap | the rest of the format's arguments. See vprintf(3) for more information. |
friend class logging_tee [friend] |
logging* plumbing::logging::singleton [static, private] |
1.6.3