MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
|
类 | |
struct | _LogDate |
Public 成员函数 | |
Log (const string &log_name, const LOG_LEVEL log_level=LOG_LEVEL_INFO, const LOG_LEVEL console_level=LOG_LEVEL_WARN) | |
template<class T > | |
Log & | operator<< (T message) |
template<class T > | |
int | panic (T message) |
template<class T > | |
int | error (T message) |
template<class T > | |
int | warnning (T message) |
template<class T > | |
int | info (T message) |
template<class T > | |
int | debug (T message) |
template<class T > | |
int | trace (T message) |
int | output (const LOG_LEVEL level, const char *module, const char *prefix, const char *f,...) |
int | set_console_level (const LOG_LEVEL console_level) |
LOG_LEVEL | get_console_level () |
int | set_log_level (const LOG_LEVEL log_level) |
LOG_LEVEL | get_log_level () |
int | set_rotate_type (LOG_ROTATE rotate_type) |
LOG_ROTATE | get_rotate_type () |
const char * | prefix_msg (const LOG_LEVEL level) |
void | set_default_module (const string &modules) |
bool | check_output (const LOG_LEVEL log_level, const char *module) |
int | rotate (const int year=0, const int month=0, const int day=0) |
void | set_context_getter (function< intptr_t()> context_getter) |
设置一个在日志中打印当前上下文信息的回调函数 更多... | |
intptr_t | context_id () |
静态 Public 成员函数 | |
static int | init (const string &log_file) |
Private 类型 | |
typedef struct common::Log::_LogDate | LogDate |
typedef map< LOG_LEVEL, string > | LogPrefixMap |
typedef set< string > | DefaultSet |
Private 属性 | |
pthread_mutex_t | lock_ |
ofstream | ofs_ |
string | log_name_ |
LOG_LEVEL | log_level_ |
LOG_LEVEL | console_level_ |
LogDate | log_date_ |
int | log_line_ |
int | log_max_line_ |
LOG_ROTATE | rotate_type_ |
LogPrefixMap | prefix_map_ |
DefaultSet | default_set_ |
function< intptr_t()> | context_getter_ |
Log & common::Log::operator<< | ( | T | message | ) |
These functions won't output header information such as FUNCTION, The user should control these information If the header information should be outputed please use LOG_PANIC, LOG_ERROR ...
void common::Log::set_context_getter | ( | function< intptr_t()> | context_getter | ) |
设置一个在日志中打印当前上下文信息的回调函数
比如设置一个获取当前session标识的函数,那么每次在打印日志时都会输出session信息。 这个回调函数返回了一个intptr_t类型的数据,可能返回字符串更好,但是现在够用了。
void common::Log::set_default_module | ( | const string & | modules | ) |
Set Default Module list if one module is default module, it will output whatever output level is lower than log_level_ or not