LingYun Studio embeded system framwork software, such as thirdparty build shell and lingyun library
guowenxue
2024-08-21 6212d67c3f0cd22167b0f154c637dca406d1c5c5
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
/*********************************************************************************
 *      Copyright:  (C) 2012 Guo Wenxue <guowenxue@gmail.com>
 *                  All rights reserved.
 *
 *       Filename:  logger.c
 *    Description:  This is the logger system test code.
 *
 *        Version:  1.0.0(08/08/2012~)
 *         Author:  Guo Wenxue <guowenxue@gmail.com>
 *      ChangeLog:  1, Release initial version on "08/08/2012 06:51:40 PM"
 *
 ********************************************************************************/
 
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <libgen.h>
#include "logger.h"
 
int main (int argc, char **argv)
{
    char    buf[256];
    int     i;
 
    for(i=0; i<sizeof(buf); i++)
        buf[i] = i;
 
#if 1
    log_open("console", LOG_LEVEL_DEBUG, 0, LOG_LOCK_DISABLE);
#else
    log_open("test.log", LOG_LEVEL_DEBUG, 10, LOG_LOCK_DISABLE);
#endif
 
    log_error("This is a errorr message\n");
    log_warn("This is a warnning message\n");
    log_info("This is a informat message\n");
    log_debug("This is a debug message\n");
    log_trace("This is a trace message\n");
 
    log_dump(LOG_LEVEL_DEBUG, "Hex dump buffer content:", buf, sizeof(buf));
 
    log_close();
    return 0;
}