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 * @brief Application Framework public header for log output
15 #ifndef _ICO_APF_LOG_H_
16 #define _ICO_APF_LOG_H_
22 /* Log output destination */
23 #ifndef ICO_APF_LOG_STDOUT
24 #define ICO_APF_LOG_STDOUT 0 /* Log output to stdout(=1) or file(=0) */
25 #endif /*ICO_APF_LOG_STDOUT*/
26 #define ICO_APF_LOG_DIR "/var/log/ico"
27 /* Directory name of Log destination */
29 /* Maximum lines/files */
30 #define ICO_APF_LOG_MAXLINES 10000 /* Maximum output lines of one log file */
31 #define ICO_APF_LOG_MAXFILES 6 /* Maximum number of the log file */
33 /* Log output level */
34 #define ICO_APF_LOG_DEBUG 128 /* Debug write */
35 #define ICO_APF_LOG_INFO 64 /* Information */
36 #define ICO_APF_LOG_WARNING 16 /* Warning */
37 #define ICO_APF_LOG_CRITICAL 8 /* Critical */
38 #define ICO_APF_LOG_ERROR 4 /* Error */
40 /* Log output flush */
41 #define ICO_APF_LOG_FLUSH 0x4000 /* Log outout with log flush */
42 #define ICO_APF_LOG_NOFLUSH 0x2000 /* Log output without log flush */
44 /* Function prototypes */
45 void ico_apf_log_print(const char *fmt, ...);
46 void ico_apf_log_open(const char *Prog);
47 void ico_apf_log_close(void);
48 void ico_apf_log_flush(void);
49 char *ico_apf_log_curtime(const char *level);
50 void ico_apf_log_setlevel(const int loglevel);
52 /* Current log output level */
53 extern int ico_apf_log_level;
55 /* Macros for log output */
56 #define ICO_APF_DEBUG(fmt,...) \
57 {if( ico_apf_log_level >= ICO_APF_LOG_DEBUG) {ico_apf_log_print("%s> "fmt" (%s,%s:%d)\n",ico_apf_log_curtime("DBG"),##__VA_ARGS__,__func__,__FILE__,__LINE__);} }
58 #define ICO_APF_INFO(fmt,...) \
59 {if( ico_apf_log_level >= ICO_APF_LOG_INFO) {ico_apf_log_print("%s> "fmt" (%s,%s:%d)\n",ico_apf_log_curtime("INF"),##__VA_ARGS__,__func__,__FILE__,__LINE__);} }
60 #define ICO_APF_WARN(fmt,...) \
61 {if( ico_apf_log_level >= ICO_APF_LOG_WARNING) {ico_apf_log_print("%s> "fmt" (%s,%s:%d)\n",ico_apf_log_curtime("WRN"),##__VA_ARGS__,__func__,__FILE__,__LINE__);} }
62 #define ICO_APF_CRITICAL(fmt,...) \
63 {if( ico_apf_log_level >= ICO_APF_LOG_CRITICAL) {ico_apf_log_print("%s> "fmt" (%s,%s:%d)\n",ico_apf_log_curtime("CRI"),##__VA_ARGS__,__func__,__FILE__,__LINE__);} }
64 #define ICO_APF_ERROR(fmt,...) \
65 {if( ico_apf_log_level >= ICO_APF_LOG_ERROR) {ico_apf_log_print("%s> "fmt" (%s,%s:%d)\n",ico_apf_log_curtime("ERR"),##__VA_ARGS__,__func__,__FILE__,__LINE__);} }
67 /* Macros for compativility */
69 #define apfw_debug ICO_APF_DEBUG
70 #define apfw_trace ICO_APF_DEBUG
71 #define apfw_info ICO_APF_INFO
72 #define apfw_warn ICO_APF_WARN
73 #define apfw_critical ICO_APF_CRITICAL
74 #define apfw_error ICO_APF_ERROR
75 #define apfw_logflush ico_apf_log_flush
78 #define uim_debug ICO_APF_DEBUG
79 #define uifw_debug ICO_APF_DEBUG
80 #define uifw_trace ICO_APF_DEBUG
81 #define uifw_info ICO_APF_INFO
82 #define uifw_warn ICO_APF_WARN
83 #define uifw_critical ICO_APF_CRITICAL
84 #define uifw_error ICO_APF_ERROR
85 #define uifw_logflush ico_apf_log_flush
87 #define ICO_UXF_DEBUG ICO_APF_DEBUG
88 #define ICO_UXF_INFO ICO_APF_INFO
89 #define ICO_UXF_WARN ICO_APF_WARN
90 #define ICO_UXF_CRITICAL ICO_APF_CRITICAL
91 #define ICO_UXF_ERROR ICO_APF_ERROR
93 #define ico_uxf_log_open ico_apf_log_open
94 #define ico_uxf_log_close ico_apf_log_close
95 #define ico_uxf_log_flush ico_apf_log_flush
96 #define ico_uxf_log_setlevel ico_apf_log_setlevel
101 #endif /* _ICO_APF_LOG_H_ */