物联网操作系统AliOS Things 3.3
ulog.h
浏览该文件的文档.
1 
6 #ifndef ULOG_H
7 #define ULOG_H
8 
9 #include <string.h>
21 #ifdef NDEBUG
22 #define CONFIG_LOGMACRO_SILENT
23 #endif
24 
25 #if defined(CONFIG_DEBUG) && CONFIG_DEBUG
26 #define DEBUG
27 #endif
28 
29 #define ULOG_TAG __FILE__, __LINE__
30 
31 #define LOG_EMERG 0 /* system is unusable */
32 #define LOG_ALERT 1 /* action must be taken immediately */
33 #define LOG_CRIT 2 /* critical conditions */
34 #define LOG_ERR 3 /* error conditions */
35 #define LOG_WARNING 4 /* warning conditions */
36 #define LOG_NOTICE 5 /* normal, but significant, condition */
37 #define LOG_INFO 6 /* informational message */
38 #define LOG_DEBUG 7 /* debug-level message */
39 #define LOG_NONE 8 /* used in stop filter, all log will pop out */
40 
41 typedef enum {
42  AOS_LL_NONE = LOG_EMERG, /* disable log */
43  AOS_LL_FATAL = LOG_CRIT, /* fatal log will output */
44  AOS_LL_ERROR = LOG_ERR, /* fatal + error log will output */
45  AOS_LL_WARN = LOG_WARNING, /* fatal + warn + error log will output(default level) */
46  AOS_LL_INFO = LOG_INFO, /* info + warn + error log will output */
47  AOS_LL_DEBUG = LOG_DEBUG, /* debug + info + warn + error + fatal log will output */
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
65 int ulog(const unsigned char s, const char *mod, const char *f,
66  const unsigned long l, const char *fmt, ...);
67 
75 #define LOG(...) ulog(LOG_ALERT, "AOS", ULOG_TAG, __VA_ARGS__)
76 
77 #ifdef CONFIG_LOGMACRO_SILENT
78 #define LOGF(mod, ...)
79 #define LOGE(mod, ...)
80 #define LOGW(mod, ...)
81 #define LOGI(mod, ...)
82 #define LOGD(mod, ...)
83 
84 #else /* !CONFIG_LOGMACRO_SILENT */
93 #define LOGF(mod, ...) ulog(LOG_CRIT, mod, ULOG_TAG, __VA_ARGS__)
94 
103 #define LOGE(mod, ...) ulog(LOG_ERR, mod, ULOG_TAG, __VA_ARGS__)
104 
113 #define LOGW(mod, ...) ulog(LOG_WARNING, mod, ULOG_TAG, __VA_ARGS__)
114 
123 #define LOGI(mod, ...) ulog(LOG_INFO, mod, ULOG_TAG, __VA_ARGS__)
124 
134 #ifdef DEBUG
135 #define LOGD(mod, ...) ulog(LOG_DEBUG, mod, ULOG_TAG, __VA_ARGS__)
136 #else
137 #define LOGD(mod, ...)
138 #endif
139 
140 #endif /* CONFIG_LOGMACRO_SILENT */
141 
151 
157 void ulog_init(void);
158 
174 int ulog_man(const char *cmd_str);
175 
190 int aos_get_ulog_list(char *buf, const unsigned short len);
191 
199 int aos_log_hexdump(const char* tag, char *buffer, int len);
200 
201 #ifdef __cplusplus
202 }
203 #endif
204 
207 #endif /* ULOG_H */
208 
int ulog(const unsigned char s, const char *mod, const char *f, const unsigned long l, const char *fmt,...)
int aos_get_ulog_list(char *buf, const unsigned short len)
#define LOG_EMERG
Definition: ulog.h:31
#define LOG_DEBUG
Definition: ulog.h:38
int aos_log_hexdump(const char *tag, char *buffer, int len)
#define LOG_ERR
Definition: ulog.h:34
#define LOG_CRIT
Definition: ulog.h:33
aos_log_level_t
Definition: ulog.h:41
int aos_set_log_level(aos_log_level_t log_level)
#define LOG_WARNING
Definition: ulog.h:35
int ulog_man(const char *cmd_str)
void ulog_init(void)
#define LOG_INFO
Definition: ulog.h:37
@ AOS_LL_WARN
Definition: ulog.h:45
@ AOS_LL_INFO
Definition: ulog.h:46
@ AOS_LL_ERROR
Definition: ulog.h:44
@ AOS_LL_NONE
Definition: ulog.h:42
@ AOS_LL_DEBUG
Definition: ulog.h:47
@ AOS_LL_FATAL
Definition: ulog.h:43