-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtest.c
46 lines (36 loc) · 784 Bytes
/
test.c
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
# include <stdio.h>
# include <error.h>
# include <errno.h>
# include <unistd.h>
# include <stdlib.h>
# include "dlog.h"
int func_b()
{
log_exception("process fail");
return -1;
}
int func_a()
{
return func_b();
}
int main()
{
log_info("system error");
dlog_t *lp = dlog_init("test", DLOG_SHIFT_BY_DAY, 0, 0, 0);
if (lp == NULL)
error(1, errno, "dlog_init fail");
default_dlog = lp;
default_dlog_flag = dlog_read_flag("fatal, error debug, info, USER1");
printf("%#x\n", default_dlog_flag);
log_vip("vip");
log_fatal("fatal");
log_error("error");
log_warn("warn");
log_info("info");
log_notice("notice");
log_debug("debug");
log_user1("hello");
log_user2("world");
func_a();
return 0;
}