TRACE <-> DEBUG
This commit is contained in:
parent
c78c758b1f
commit
03aa94502d
@ -40,7 +40,7 @@ static struct {
|
||||
NULL, NULL, RXI_LOGC_DEFAULT_LEVEL, false, {{0}},
|
||||
};
|
||||
|
||||
static const char *level_strings[] = {"[[DEBUG]]", "[[TRACE]]", "[[ INFO]]",
|
||||
static const char *level_strings[] = {"[[TRACE]]", "[[DEBUG]]", "[[ INFO]]",
|
||||
"[[ WARN]]", "[[ERROR]]", "[[FATAL]]"};
|
||||
|
||||
static inline const char *get_level_string(int level) {
|
||||
@ -48,7 +48,7 @@ static inline const char *get_level_string(int level) {
|
||||
}
|
||||
|
||||
#ifdef LOG_USE_COLOR
|
||||
static const char *level_colors[] = {"\x1b[36m", "\x1b[94m", "\x1b[32m",
|
||||
static const char *level_colors[] = {"\x1b[94m", "\x1b[36m", "\x1b[32m",
|
||||
"\x1b[33m", "\x1b[31m", "\x1b[35m"};
|
||||
|
||||
static inline const char *get_level_color(int level) {
|
||||
@ -120,7 +120,7 @@ int log_add_fp(FILE *fp, int level) {
|
||||
static void init_event(log_Event *ev, void *udata) {
|
||||
if (!ev->time) {
|
||||
time_t t = time(NULL);
|
||||
ev->time = localtime_r(&t, &ev->time_buf);
|
||||
ev->time = localtime(&t, &ev->time_buf);
|
||||
}
|
||||
ev->udata = udata;
|
||||
}
|
||||
|
16
src/log.h
16
src/log.h
@ -16,7 +16,7 @@
|
||||
#define LOG_VERSION "0.1.0"
|
||||
|
||||
#ifndef RXI_LOGC_DEFAULT_LEVEL
|
||||
#define RXI_LOGC_DEFAULT_LEVEL LOG_TRACE
|
||||
#define RXI_LOGC_DEFAULT_LEVEL LOG_DEBUG
|
||||
#endif
|
||||
|
||||
#if defined __GNUC__
|
||||
@ -26,8 +26,8 @@
|
||||
#endif
|
||||
|
||||
enum {
|
||||
LOG_DEBUG = -32,
|
||||
LOG_TRACE = 0,
|
||||
LOG_TRACE = -32,
|
||||
LOG_DEBUG = 0,
|
||||
LOG_INFO = 32,
|
||||
LOG_WARN = 64,
|
||||
LOG_ERROR = 96,
|
||||
@ -48,16 +48,16 @@ typedef struct {
|
||||
typedef void (*log_LogFn)(log_Event *ev);
|
||||
typedef void (*log_LockFn)(bool lock, void *udata);
|
||||
|
||||
#define log_debug(...) \
|
||||
do { \
|
||||
if (LOG_DEBUG >= RXI_LOGC_DEFAULT_LEVEL) \
|
||||
log_log(LOG_DEBUG, __FILE__, __LINE__, __VA_ARGS__); \
|
||||
} while (0)
|
||||
#define log_trace(...) \
|
||||
do { \
|
||||
if (LOG_TRACE >= RXI_LOGC_DEFAULT_LEVEL) \
|
||||
log_log(LOG_TRACE, __FILE__, __LINE__, __VA_ARGS__); \
|
||||
} while (0)
|
||||
#define log_debug(...) \
|
||||
do { \
|
||||
if (LOG_DEBUG >= RXI_LOGC_DEFAULT_LEVEL) \
|
||||
log_log(LOG_DEBUG, __FILE__, __LINE__, __VA_ARGS__); \
|
||||
} while (0)
|
||||
#define log_info(...) \
|
||||
do { \
|
||||
if (LOG_INFO >= RXI_LOGC_DEFAULT_LEVEL) \
|
||||
|
Loading…
Reference in New Issue
Block a user