-
Notifications
You must be signed in to change notification settings - Fork 0
/
readme
57 lines (45 loc) · 1.81 KB
/
readme
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
simple logger
v1.0
if init with config file
/*
splog.cfg ascii file
filename@loglevel@logtype
logtype=[tofile toconsole]
loglevel=[debug,info,warning,error,fatal]
example
log.txt@warning@tofile
*/
or
#define SLOG_DEFAULT_INIT splog::logger GLOG;
#define SLOG_TOFILE_LEVEL_INIT(log_filename,loglevel) SLOG_COMMON_INIT(log_filename,loglevel,NULL)
#define SLOG_TOFILE_INIT(log_filename) SLOG_TOFILE_LEVEL_INIT(log_filename,(splog::LOGL_DEBUG))
#define SLOG_CFG_INIT(cfg_filename) SLOG_TOFILE_LEVEL_INIT(DEFAULT_LOG_FILENAME,(splog::LOGL_DEBUG),cfg_filename)
#define SLOG_CFG_DEFAULT_INIT SLOG_CFG_INIT(DEFAULT_CFG_FILENAME)
/*
default log write
*/
#define SLOG_DEBUG(foramt,...) GLOG.log_fmt_debug(foramt,##__VA_ARGS__)
#define SLOG_INFO(foramt,...) GLOG.log_fmt_info(foramt,##__VA_ARGS__)
#define SLOG_WARNING(foramt,...) GLOG.log_fmt_warning(foramt,##__VA_ARGS__)
#define SLOG_ERROR(foramt,...) GLOG.log_fmt_error(foramt,##__VA_ARGS__)
#define SLOG_FATAL(foramt,...) GLOG.log_fmt_fatal(foramt,##__VA_ARGS__)
V1.1 2017.3.3.23
support linux version
add function name ,thread id information
support set_log_flag()
#define SLTIME 1 time
#define SLTID 2 threadid
#define SLSRCFL 4 filename line number
#define SLLEVEL 8 level info
#define SLMSG 16 sufix info
#define SLFUNCNAME 32 function name
#define SLALL (SLTIME|SLTID|SLSRCFL|SLLEVEL|SLMSG|SLFUNCNAME)
SET_LOG_FLAG(SLALL)
v1.1.1 2017.6.12
add convenient error info function
#define SLOG_INVALID_ARGS SLOG_FATAL("INVALID ARGUMENTS");
#define SLOG_NULL_POINTER SLOG_FATAL("NULL POINTER");
#define SLOG_BUFFER_TOO_SMALL SLOG_FATAL("DATA OR BUFFER TOO SMALL");
#define SLOG_BUFFER_TOO_LARGE SLOG_FATAL("DATA OR BUFFER TOO LARGE");
#define SLOG_REACHHERE SLOG_FATAL("REACH HERE");
#define SLOG_SYS_API_ERROR SLOG_FATAL("CALL SYSAPI ERROR");