2 * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
4 * This program is licensed under the terms and conditions of the
5 * Apache License, version 2.0. The full text of the Apache License is at
6 * http://www.apache.org/licenses/LICENSE-2.0
10 /*========================================================================*/
14 * @brief debug log function
16 /*========================================================================*/
24 #ifndef ICO_LOG_STDOUT
25 #define ICO_LOG_STDOUT 0
26 /**!< Log output to stdout(=1) or file(=0) */
27 #endif /*ICO_APF_LOG_STDOUT*/
29 #define ICO_LOG_DIR "/var/log/ico"
30 /**!< Directory name of Log destination */
32 /* Maximum lines/files */
33 #define ICO_LOG_MAXLINES 10000
34 /**!< Maximum output lines of log file */
35 #define ICO_LOG_MAXFILES 6
36 /**!< Maximum number of the log file */
38 /* Log output level */
39 #define ICO_LOG_DEBUG 0x0080 /**!< Debug write */
40 #define ICO_LOG_INFO 0x0040 /**!< Information */
41 #define ICO_LOG_WARNING 0x0010 /**!< Warning */
42 #define ICO_LOG_CRITICAL 0x0008 /**!< Critical */
43 #define ICO_LOG_ERROR 0x0004 /**!< Error */
45 /* Log output flush */
46 #define ICO_LOG_FLUSH 0x4000 /**!< Log outout with log flush */
47 #define ICO_LOG_NOFLUSH 0x2000 /**!< Log output without log flush */
49 #define ICO_TRA(fmt,...) \
51 ico_log_print(ICO_LOG_DEBUG, \
52 "%s> " fmt " (%s,%s:%d)\n", \
53 ico_get_str_cur_time("DBG"), \
60 #define ICO_DBG(fmt,...) \
62 ico_log_print(ICO_LOG_DEBUG, \
63 "%s> " fmt " (%s,%s:%d)\n", \
64 ico_get_str_cur_time("DBG"), \
71 #define ICO_INF(fmt,...) \
73 ico_log_print(ICO_LOG_INFO, \
74 "%s> " fmt " (%s,%s:%d)\n", \
75 ico_get_str_cur_time("INF"), \
82 #define ICO_WRN(fmt,...) \
84 ico_log_print(ICO_LOG_WARNING, \
85 "%s> " fmt " (%s,%s:%d)\n", \
86 ico_get_str_cur_time("WRN"), \
93 #define ICO_CRI(fmt,...) \
95 ico_log_print(ICO_LOG_CRITICAL, \
96 "%s> " fmt " (%s,%s:%d)\n", \
97 ico_get_str_cur_time("CRI"), \
104 #define ICO_ERR(fmt,...) \
106 ico_log_print(ICO_LOG_ERROR, \
107 "%s> " fmt " (%s,%s:%d)\n", \
108 ico_get_str_cur_time("ERR"), \
116 void ico_log_print(int level, const char *fmt, ...);
117 void ico_log_open(const char *prog);
118 void ico_log_close(void);
119 void ico_log_flush(void);
120 char * ico_get_str_cur_time(const char *level);
121 void ico_log_set_level(int level);
127 #endif // __ICO__LOG_H__
128 /* vim:set expandtab ts=4 sw=4: */