-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.h
35 lines (30 loc) · 1005 Bytes
/
log.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef LOG_H_
#define LOG_H_
#define LOG(LVL, MSG) log_log(LVL, "[%s]"MSG, MODULE_NAME)
#define ALL(MSG) LOG(LOGGER_ALL, MSG)
#define ERR(MSG) LOG(LOGGER_ERROR, MSG)
#define WRN(MSG) LOG(LOGGER_WARN, MSG)
#define INF(MSG) LOG(LOGGER_INFO, MSG)
#define DBG(MSG) LOG(LOGGER_DEBUG, MSG)
#define LOGF(LVL, FMT, ...) log_log(LVL, "[%s]"FMT, MODULE_NAME, __VA_ARGS__)
#define ALLF(FMT, ...) LOGF(LOGGER_ALL, FMT, __VA_ARGS__)
#define ERRF(FMT, ...) LOGF(LOGGER_ERROR, FMT, __VA_ARGS__)
#define WRNF(FMT, ...) LOGF(LOGGER_WARN, FMT, __VA_ARGS__)
#define INFF(FMT, ...) LOGF(LOGGER_INFO, FMT, __VA_ARGS__)
#define DBGF(FMT, ...) LOGF(LOGGER_DEBUG, FMT, __VA_ARGS__)
enum {
LOGGER_ALL=-1,
LOGGER_SILENT=0,
LOGGER_ERROR,
LOGGER_WARN,
LOGGER_INFO,
LOGGER_DEBUG
};
void log_file_set(char *filename);
void log_cverb_set(int lvl);
void log_fverb_set(int lvl);
void log_color_set(bool t);
void log_prettytime_set(bool t);
char *log_color_get4lvl(int lvl);
void log_log(int lvl, const char *fmt, ...);
#endif