#include <libppbase/base/Log.h>
Public Types | |
enum | levels { FATAL = 1, ERR, WARNING, NOTICE, INFO, DEBUG } |
log levels More... | |
Public Member Functions | |
Log (const String &name, enum levels level=NOTICE) | |
Constructor. | |
void | debug (const char *func, const char *fmt,...) |
Logs a debug message. | |
void | debug (const char *func, const String &msg) |
Logs a debug message. | |
void | error (const char *func, const char *fmt,...) |
Logs an error message. | |
void | error (const char *func, const String &msg) |
Logs an error message. | |
void | error (const char *func, const Exception &ex) |
Logs an exception as error. | |
void | fatal (const char *func, const char *fmt,...) |
Logs a fatal message. | |
void | fatal (const char *func, const String &msg) |
Logs a fatal message. | |
levels | getLoglevel () const |
Returns current loglevel. | |
String | getLogfile () |
Returns current log file name. | |
void | info (const char *func, const char *fmt,...) |
Logs an informal message. | |
void | info (const char *func, const String &msg) |
Logs an informal message. | |
void | vlog (enum levels level, const char *func, const char *fmt, va_list ap) |
Logs a message. | |
void | log (enum levels level, const char *func, const char *fmt,...) |
Logs a message. | |
void | log (enum levels level, const char *func, const String &msg) |
Logs a message. | |
void | notice (const char *func, const char *fmt,...) |
Logs a notice. | |
void | notice (const char *func, const String &msg) |
Logs a notice. | |
void | setLoglevel (enum levels level) |
Changes the loglevel. | |
void | setPid (Process::pid_type pid=0) |
Changes the process ID. | |
void | setStdErrLog (bool on=true) |
Enable/Disable logging to stderr. | |
void | warn (const char *func, const char *fmt,...) |
Logs an warning message. | |
void | warn (const char *func, const String &msg) |
Logs an warning message. | |
Static Public Member Functions | |
static const char * | getLoglevelName (enum levels level) |
Returns name of log level. |
Log class.
enum base::Log::levels |
Constructor.
name | program or file name (file name must contain at least one ".", "/" or "\", otherwise program name is assumed) | |
level | the log level |
void base::Log::debug | ( | const char * | func, | |
const char * | fmt, | |||
... | ||||
) |
Logs a debug message.
void base::Log::error | ( | const char * | func, | |
const Exception & | ex | |||
) |
Logs an exception as error.
void base::Log::error | ( | const char * | func, | |
const char * | fmt, | |||
... | ||||
) |
Logs an error message.
void base::Log::fatal | ( | const char * | func, | |
const char * | fmt, | |||
... | ||||
) |
Logs a fatal message.
String base::Log::getLogfile | ( | ) |
Returns current log file name.
levels base::Log::getLoglevel | ( | ) | const |
Returns current loglevel.
static const char* base::Log::getLoglevelName | ( | enum levels | level | ) | [static] |
Returns name of log level.
void base::Log::info | ( | const char * | func, | |
const char * | fmt, | |||
... | ||||
) |
Logs an informal message.
void base::Log::info | ( | const char * | func, | |
const String & | msg | |||
) |
Logs an informal message.
Logs a message.
level | the log level | |
func | the function or method that writes the message | |
msg | the message |
void base::Log::log | ( | enum levels | level, | |
const char * | func, | |||
const char * | fmt, | |||
... | ||||
) |
Logs a message.
level | the log level | |
func | the function or method that writes the message | |
fmt | the message, in printf-format | |
... | additional arguments for the message |
void base::Log::notice | ( | const char * | func, | |
const char * | fmt, | |||
... | ||||
) |
Logs a notice.
void base::Log::setLoglevel | ( | enum levels | level | ) |
Changes the loglevel.
level | the new loglevel |
void base::Log::setPid | ( | Process::pid_type | pid = 0 |
) |
Changes the process ID.
pid | the new process id |
void base::Log::setStdErrLog | ( | bool | on = true |
) |
Enable/Disable logging to stderr.
on | true for logging to stderr |
void base::Log::vlog | ( | enum levels | level, | |
const char * | func, | |||
const char * | fmt, | |||
va_list | ap | |||
) |
Logs a message.
level | the log level | |
func | the function or method that writes the message | |
fmt | the message, in printf-format | |
ap | additional arguments for the message |
void base::Log::warn | ( | const char * | func, | |
const String & | msg | |||
) |
Logs an warning message.
void base::Log::warn | ( | const char * | func, | |
const char * | fmt, | |||
... | ||||
) |
Logs an warning message.