|
static void | exit (void) |
| Safely exit the logger. More...
|
|
static int | log (int level, const char *fmt,...) |
| Record and print a message into log file. More...
|
|
static void | logQueries (int level, std::vector< genie::query::Query > &queries, size_t max_print_len=128) |
|
static void | logResults (int level, std::vector< genie::query::Query > &queries, std::vector< int > &result, std::vector< int > &result_count, size_t max_print_len=128) |
|
static void | logTable (int level, genie::table::inv_table *table, size_t max_print_len=32) |
|
static void | logInvLists (int level, const std::vector< std::vector< uint32_t > > &rawInvertedLists, size_t max_print_len=128) |
|
static void | set_level (int level) |
| Set the screen print level for the logger. More...
|
|
static int | get_level () |
| Get the current screen print level. More...
|
|
static void | set_logfile_name (const char *name) |
| Set the log file name. More...
|
|
static const char * | get_logfile_name () |
| Get the current log file name. More...
|
|
A utility class to record logs into disk files.
The Logger class is implemented using Singleton model and all logging calls should go through static method Logger::log .
Please set your screen print level of log information by calling Logger::set_level .
Please remember to call the Logger::exit method to safely instruct the Logger to flush and close all opened files and free occupied memory.
Definition at line 41 of file Logger.h.
static int genie::utility::Logger::log |
( |
int |
level, |
|
|
const char * |
fmt, |
|
|
|
... |
|
) |
| |
|
static |
Record and print a message into log file.
The log call will direct the parameters except the level to std::sprintf .
If the current screen print level is higher than the provided logging level in the parameter, the message will be logged and printed. Otherwise the message will only be logged.
- Parameters
-
level | The logging level of the message. |
fmt | The printing format of the message. See std::printf . |
... | The rest of parameters according to your format. |
- Returns
- 1 if the message is to be printed on screen or 0 otherwise.
Definition at line 99 of file Logger.cc.
static void genie::utility::Logger::set_level |
( |
int |
level | ) |
|
|
static |
Set the screen print level for the logger.
Once set, the Logger will only print messages whose logging levels are higher than the set value to screen.
It is recommended to set the screen print level at the beginning of the program.
- Parameters
-
level | The desired screen print level. |
Definition at line 74 of file Logger.cc.
static void genie::utility::Logger::set_logfile_name |
( |
const char * |
name | ) |
|
|
static |
Set the log file name.
Once set, the Logger will write all log all messages in the current session to the file with the provided name.
The file will be created if it does not exist.
If not called, the default file name is set using the system current date and time.
- Parameters
-
name | The desired log file name. |
Definition at line 83 of file Logger.cc.