#include <logger.h>
Public Types | |
typedef enum iplatypus::logger::log_t | priority |
debug = 0 | |
info | |
warn | |
error | |
fatal | |
enum | log_t { debug = 0, info, warn, error, fatal } |
The log priorities. debug < info < warn < error < fatal. More... | |
Public Member Functions | |
void | bind (const log_t lt, const std::string &to_file=CONSOLE) |
void | bind_specific (const log_t lt, const std::string &to_file=CONSOLE) |
void | log_level (const log_t newlevel) |
const log_t | log_level (void) const |
void | write (const log_t lt, const std::string &msg) |
void | write (const std::string &srcfile, const log_t lt, const std::string &msg) |
void | write_debug (const std::string &msg) |
void | write_info (const std::string &msg) |
void | write_warn (const std::string &msg) |
void | write_error (const std::string &msg) |
void | write_fatal (const std::string &msg) |
Static Public Member Functions | |
static logger * | instance (const std::string &src, const log_t level=warn) |
static logger * | instance (const std::string &src, const std::string &homedir, const log_t level=warn) |
static void | terminate (void) |
Protected Member Functions | |
logger (void) | |
logger (const std::string &src, const log_t level=warn) | |
logger (const std::string &src, const std::string &homedir, const log_t level=warn) | |
virtual | ~logger (void) |
logger (const logger &refcpy) | |
std::string | timestamp (void) |
typedef enum iplatypus::logger::log_t iplatypus::logger::priority |
iplatypus::logger::logger | ( | void | ) | [inline, protected] |
iplatypus::logger::logger | ( | const std::string & | src, | |
const log_t | level = warn | |||
) | [protected] |
iplatypus::logger::logger | ( | const std::string & | src, | |
const std::string & | homedir, | |||
const log_t | level = warn | |||
) | [protected] |
virtual iplatypus::logger::~logger | ( | void | ) | [inline, protected, virtual] |
iplatypus::logger::logger | ( | const logger & | refcpy | ) | [inline, protected] |
iplatypus::logger::bind | ( | const log_t | lt, | |
const std::string & | to_file = CONSOLE | |||
) |
Binds a log priority to a specific file. When you bind a priority, itself, and all priorities greater than itself are all bound to the same file. For example, if you bind Log::warn to errors.log, then Log::warn, Log::error, and Log::fatal will all write to errors.log.
lt | a log priority | |
to_file | the file to bind the priority to. |
bind_specific(log_t lt, const std::string& to_file = console)
iplatypus::logger::bind_specific | ( | const log_t | lt, | |
const std::string & | to_file = CONSOLE | |||
) |
iplatypus::logger::instance | ( | const std::string & | src, | |
const std::string & | homedir, | |||
const log_t | level = warn | |||
) | [static] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
A static member. Member for retreiving an instance of the singleton object. This should be used in place of the constructors.
src | name of the file that this instance will be logging from | |
homedir | name of the directory to store the logs in (default: logs/) | |
level | log_t priority (or greater) to write out |
static logger* iplatypus::logger::instance | ( | const std::string & | src, | |
const log_t | level = warn | |||
) | [static] |
const log_t iplatypus::logger::log_level | ( | void | ) | const [inline] |
iplatypus::logger::log_level | ( | const log_t | lt | ) | [inline] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Accessor for the currently set log level.
none |
iplatypus::logger::terminate | ( | void | ) | [inline, static] |
std::string iplatypus::logger::timestamp | ( | void | ) | [protected] |
iplatypus::logger::write | ( | const std::string & | srcfile, | |
const log_t | lt, | |||
const std::string & | msg | |||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Overloaded write to allow for the temporary redefinition of the source file.
srcfile | name of the file the log entry is originating from. | |
lt | a log priority | |
msg | the log entry to write |
iplatypus::logger::write | ( | const log_t | lt, | |
const std::string & | msg | |||
) |
Writes out the log message to wherever the priority has been bound. Log messages are appended, so bear in mind that you'll have to do something to gaurd against oversized files. Obviously, messages bound to console are not an issue. messages are logged in the following format: timestamp | src_file | priority | message
lt | a log priority | |
msg | the log entry to write |
iplatypus::logger::write_debug | ( | const std::string & | msg | ) | [inline] |
A convenience wrapper for debug entries
msg | - string message to be logged |
iplatypus::logger::write_error | ( | const std::string & | msg | ) | [inline] |
A convenience wrapper for debug entries
msg | - string message to be logged |
iplatypus::logger::write_fatal | ( | const std::string & | msg | ) | [inline] |
A convenience wrapper for debug entries
msg | - string message to be logged |
iplatypus::logger::write_info | ( | const std::string & | msg | ) | [inline] |
A convenience wrapper for debug entries
msg | - string message to be logged |
iplatypus::logger::write_warn | ( | const std::string & | msg | ) | [inline] |
A convenience wrapper for debug entries
msg | - string message to be logged |