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 20000
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_LVL_PRF 0x0200 /**!< Performance */
40 #define ICO_LOG_LVL_TRA 0x0100 /**!< Trace */
41 #define ICO_LOG_LVL_DBG 0x0080 /**!< Debug write */
42 #define ICO_LOG_LVL_INF 0x0040 /**!< Information */
43 #define ICO_LOG_LVL_WRN 0x0010 /**!< Warning */
44 #define ICO_LOG_LVL_CRI 0x0008 /**!< Critical */
45 #define ICO_LOG_LVL_ERR 0x0004 /**!< Error */
47 /* Log output flush */
48 #define ICO_LOG_FLUSH 0x4000 /**!< Log outout with log flush */
49 #define ICO_LOG_NOFLUSH 0x2000 /**!< Log output without log flush */
51 #define ICO_PRF(fmt,...) \
53 ico_log_print(ICO_LOG_LVL_PRF, \
54 "%s> " fmt " (%s,%s:%d)\n", \
55 ico_get_str_cur_time("PRF"), \
62 #define ICO_TRA(fmt,...) \
64 ico_log_print(ICO_LOG_LVL_TRA, \
65 "%s> " fmt " (%s,%s:%d)\n", \
66 ico_get_str_cur_time("TRA"), \
73 #define ICO_DBG(fmt,...) \
75 ico_log_print(ICO_LOG_LVL_DBG, \
76 "%s> " fmt " (%s,%s:%d)\n", \
77 ico_get_str_cur_time("DBG"), \
84 #define ICO_INF(fmt,...) \
86 ico_log_print(ICO_LOG_LVL_INF, \
87 "%s> " fmt " (%s,%s:%d)\n", \
88 ico_get_str_cur_time("INF"), \
95 #define ICO_WRN(fmt,...) \
97 ico_log_print(ICO_LOG_LVL_WRN, \
98 "%s> " fmt " (%s,%s:%d)\n", \
99 ico_get_str_cur_time("WRN"), \
106 #define ICO_CRI(fmt,...) \
108 ico_log_print(ICO_LOG_LVL_CRI, \
109 "%s> " fmt " (%s,%s:%d)\n", \
110 ico_get_str_cur_time("CRI"), \
117 #define ICO_ERR(fmt,...) \
119 ico_log_print(ICO_LOG_LVL_ERR, \
120 "%s> " fmt " (%s,%s:%d)\n", \
121 ico_get_str_cur_time("ERR"), \
129 void ico_log_print(int level, const char *fmt, ...);
130 void ico_log_open(const char *prog);
131 void ico_log_close(void);
132 void ico_log_flush(void);
133 char * ico_get_str_cur_time(const char *level);
134 void ico_log_set_level(int level);
140 #endif // __ICO__LOG_H__
141 /* vim:set expandtab ts=4 sw=4: */