commit | author | age
|
cfdcbd
|
1 |
/********************************************************************************* |
G |
2 |
* Copyright: (C) 2012 Guo Wenxue <guowenxue@gmail.com> |
|
3 |
* All rights reserved. |
|
4 |
* |
|
5 |
* Filename: test_logger.c |
|
6 |
* Description: This is the linux logger system test code. |
|
7 |
* |
|
8 |
* Version: 1.0.0(08/08/2012~) |
|
9 |
* Author: Guo Wenxue <guowenxue@gmail.com> |
|
10 |
* ChangeLog: 1, Release initial version on "08/08/2012 06:51:40 PM" |
|
11 |
* |
|
12 |
********************************************************************************/ |
|
13 |
|
|
14 |
#include <unistd.h> |
|
15 |
#include <stdio.h> |
|
16 |
#include <string.h> |
|
17 |
#include <libgen.h> |
|
18 |
#include "logger.h" |
|
19 |
|
|
20 |
int main (int argc, char **argv) |
|
21 |
{ |
|
22 |
char buf[256]; |
|
23 |
int i; |
|
24 |
|
|
25 |
for(i=0; i<sizeof(buf); i++) |
|
26 |
buf[i] = i; |
|
27 |
|
|
28 |
#if 0 |
|
29 |
log_open("console", LOG_LEVEL_DEBUG, 0, LOG_LOCK_DISABLE); |
|
30 |
#else |
|
31 |
log_open("test.log", LOG_LEVEL_DEBUG, 10, LOG_LOCK_DISABLE); |
|
32 |
#endif |
|
33 |
|
|
34 |
log_error("This is a errorr message\n"); |
|
35 |
log_warn("This is a warnning message\n"); |
|
36 |
log_info("This is a informat message\n"); |
|
37 |
log_debug("This is a debug message\n"); |
|
38 |
log_trace("This is a trace message\n"); |
|
39 |
|
|
40 |
log_dump(LOG_LEVEL_DEBUG, "Hex dump buffer content:", buf, sizeof(buf)); |
|
41 |
|
|
42 |
log_close(); |
|
43 |
return 0; |
|
44 |
} |
|
45 |
|