1 //! Simple example program
4 #include "flog_output_stdio.h"
5 #include "flog_output_file.h"
13 FLOG_T
*log_main
,*log_subfunc
;
14 printf("-[flog test start]-\n");
17 log_main
= create_flog_t(__func__
,FLOG_ACCEPT_DEEP_DEBUG
);
18 log_main
->error_log
=log_main
;
19 log_subfunc
= create_flog_t("subfunc",FLOG_ACCEPT_DEEP_DEBUG
);
20 log_subfunc
->error_log
=log_main
;
21 flog_append_sublog(log_subfunc
,log_main
);
22 #ifdef FLOG_CONFIG_OUTPUT_STDIO
23 FLOG_T
*log_stdout
,*log_stderr
;
24 log_stdout
= create_flog_output_stdout("stdout",FLOG_ACCEPT_ONLY_ERROR
);
25 log_stdout
->error_log
=log_main
;
26 flog_append_sublog(log_main
,log_stdout
);
27 log_stderr
= create_flog_output_stderr("stderr",FLOG_ACCEPT_ALL
);
28 log_stderr
->error_log
=log_main
;
29 flog_append_sublog(log_main
,log_stderr
);
31 #ifdef FLOG_CONFIG_OUTPUT_FILE
33 log_file
= create_flog_output_file("file",FLOG_ACCEPT_ALL
,"test.log");
34 log_file
->error_log
=log_main
;
35 flog_append_sublog(log_main
,log_file
);
38 flog_print(log_subfunc
,"print_test",FLOG_ERROR
,0,"testing...");
39 flog_printf(log_subfunc
,"printf_test",FLOG_INFO
,0,"testing... %d %d %d",1,2,3);
41 flog_print(log_subfunc
,NULL
,FLOG_ERROR
,FLOG_MSG_MARK
,NULL
);
42 flog_print(log_subfunc
,NULL
,FLOG_ERROR
,ENOMEM
,NULL
);
44 flog_assert(log_subfunc
,1+1);
45 //flog_assert(log_subfunc,1-1);
48 printf("-[flog test suite]-\n");
53 //for(i=0;i<10000000;i++)
54 //flog_print(log_subfunc,NULL,FLOG_DEEP_DEBUG,FLOG_MSG_MARK,NULL);
56 destroy_flog_t(log_subfunc
);
57 destroy_flog_t(log_main
);
58 #ifdef FLOG_CONFIG_OUTPUT_STDIO
59 destroy_flog_t(log_stdout
);
60 destroy_flog_t(log_stderr
);
62 #ifdef FLOG_CONFIG_OUTPUT_FILE
63 destroy_flog_output_file(log_file
);