|
#define | ULOG_TAG __FILE__, __LINE__ |
|
#define | LOG_EMERG 0 /* system is unusable */ |
|
#define | LOG_ALERT 1 /* action must be taken immediately */ |
|
#define | LOG_CRIT 2 /* critical conditions */ |
|
#define | LOG_ERR 3 /* error conditions */ |
|
#define | LOG_WARNING 4 /* warning conditions */ |
|
#define | LOG_NOTICE 5 /* normal, but significant, condition */ |
|
#define | LOG_INFO 6 /* informational message */ |
|
#define | LOG_DEBUG 7 /* debug-level message */ |
|
#define | LOG_NONE 8 /* used in stop filter, all log will pop out */ |
|
#define | LOG(...) ulog(LOG_ALERT, "AOS", ULOG_TAG, __VA_ARGS__) |
|
#define | LOGF(mod, ...) ulog(LOG_CRIT, mod, ULOG_TAG, __VA_ARGS__) |
|
#define | LOGE(mod, ...) ulog(LOG_ERR, mod, ULOG_TAG, __VA_ARGS__) |
|
#define | LOGW(mod, ...) ulog(LOG_WARNING, mod, ULOG_TAG, __VA_ARGS__) |
|
#define | LOGI(mod, ...) ulog(LOG_INFO, mod, ULOG_TAG, __VA_ARGS__) |
|
#define | LOGD(mod, ...) |
|
Optional policy of log, which can output into default direction, virtual file system, mqtt channel and syslog udp.
◆ LOG
Log at the alert level, brief using of ulog.
- 参数
-
[in] | ... | same as printf() usage. |
- 返回
- 0 on success, negative error on failure.
在文件 ulog.h 第 76 行定义.
◆ LOG_ALERT
#define LOG_ALERT 1 /* action must be taken immediately */ |
◆ LOG_CRIT
#define LOG_CRIT 2 /* critical conditions */ |
◆ LOG_DEBUG
#define LOG_DEBUG 7 /* debug-level message */ |
◆ LOG_EMERG
#define LOG_EMERG 0 /* system is unusable */ |
◆ LOG_ERR
#define LOG_ERR 3 /* error conditions */ |
◆ LOG_INFO
#define LOG_INFO 6 /* informational message */ |
◆ LOG_NONE
#define LOG_NONE 8 /* used in stop filter, all log will pop out */ |
◆ LOG_NOTICE
#define LOG_NOTICE 5 /* normal, but significant, condition */ |
◆ LOG_WARNING
#define LOG_WARNING 4 /* warning conditions */ |
◆ LOGD
#define LOGD |
( |
|
mod, |
|
|
|
... |
|
) |
| |
Log at debug level, brief using of ulog.
- 注解
- : This Log API take effect only the switcher 'DEBUG' is switch on.
- 参数
-
[in] | mod | string description of module. |
[in] | ... | same as printf() usage. |
- 返回
- 0 on success, negative error on failure.
在文件 ulog.h 第 138 行定义.
◆ LOGE
Log at error level, brief using of ulog.
- 参数
-
[in] | mod | string description of module. |
[in] | ... | same as printf() usage. |
- 返回
- 0 on success, negative error on failure.
在文件 ulog.h 第 104 行定义.
◆ LOGF
Log at fatal level, brief using of ulog.
- 参数
-
[in] | mod | string description of module. |
[in] | ... | same as printf() usage. |
- 返回
- 0 on success, negative error on failure.
在文件 ulog.h 第 94 行定义.
◆ LOGI
Log at info level, brief using of ulog.
- 参数
-
[in] | mod | string description of module. |
[in] | ... | same as printf() usage. |
- 返回
- 0 on success, negative error on failure.
在文件 ulog.h 第 124 行定义.
◆ LOGW
Log at warning level, brief using of ulog.
- 参数
-
[in] | mod | string description of module. |
[in] | ... | same as printf() usage. |
- 返回
- 0 on success, negative error on failure.
在文件 ulog.h 第 114 行定义.
◆ ULOG_TAG
#define ULOG_TAG __FILE__, __LINE__ |
Important!!! Switch on NDEBUG will make no log produced(except use API LOG), it doesn't work even you try to increase log level.
在文件 ulog.h 第 30 行定义.
◆ aos_log_level_t
枚举值 |
---|
AOS_LL_NONE | |
AOS_LL_FATAL | |
AOS_LL_ERROR | |
AOS_LL_WARN | |
AOS_LL_INFO | |
AOS_LL_DEBUG | |
在文件 ulog.h 第 42 行定义.
◆ aos_get_ulog_list()
int aos_get_ulog_list |
( |
char * |
buf, |
|
|
const unsigned short |
len |
|
) |
| |
Function prototype for get ulog list recorded in file system. Precondition of use this function is switch on ULOG_POP_FS_ENABLE The result is usually like below: {"time":" 4.500",list:[{"idx":1,"start":" 0.000","end":""}]} context of time is system time when called, list show the start time and end time of special index. If value of end time is empty, means this log file is logging.
- 参数
-
[in] | buf | buffer received the context of file list |
[in] | len | length of buffer |
- 返回
- 0 sucessfully, -EINVAL param illegal, -ENOMEM not enough room to receive file list, -EIO system error.
◆ aos_log_hexdump()
int aos_log_hexdump |
( |
const char * |
tag, |
|
|
char * |
buffer, |
|
|
int |
len |
|
) |
| |
Dump buffer by hex.
- 参数
-
[in] | tag | tag |
[in] | buffer | buffer |
[in] | len | buffer len |
- 返回
- zero on success. On error, yoc_err is returned
◆ aos_set_log_level()
Set the log level.
- 参数
-
[in] | log_level | level to be set,must be one of AOS_LL_NONE,AOS_LL_FATAL, AOS_LL_ERROR,AOS_LL_WARN,AOS_LL_INFO or AOS_LL_DEBUG. |
- 返回
- 0 on success, negative error on failure.
◆ aos_set_log_output()
int aos_set_log_output |
( |
void(*)(const char *fmt,...) |
output_func | ) |
|
Set the log terminal output func.
- 参数
-
[in] | void | (output_func)(const char fmt, ...)
function to output log for terminal in different platform |
- 返回
- 0 on success, negative error on failure.
◆ ulog()
int ulog |
( |
const unsigned char |
s, |
|
|
const char * |
mod, |
|
|
const char * |
f, |
|
|
const unsigned long |
l, |
|
|
const char * |
fmt, |
|
|
|
... |
|
) |
| |
Function prototype for syncronized log text, Recommed using below brief API LOGX instead of this.
- 参数
-
[in] | s | Serverity of Log |
[in] | mod | Module name |
[in] | f | Usually File name |
[in] | l | Usually Line number of comment |
[in] | fmt,... | Variable Parameter, support format print to log |
- 返回
- 0 on success, negative error on failure.
◆ ulog_init()
Function prototype for log init. This is called in system level automatically, it is not necessary calling it in application.
◆ ulog_man()
int ulog_man |
( |
const char * |
cmd_str | ) |
|
Function prototype for ulog management.
- 参数
-
[in] | cmd_str | command string, user fill the command string to manage ulog, format shall as below: "tcpip service=1" or "tcpip service=0" to notice the tcpip feature is install or not, which have impact on the ulog pop out via udp session; "listen ip=16777343" to nofice the syslog listener's address is 127.0.0.1; "fspause=1" or "fspause=0" to command pause/resume into file system or not; "ulog file up=1" to notify upload log file 1 via http. |
- 返回
- 0 on Success, -EINVAL: invalid parameter, -EPERM: ulog module not initied yet, -EACCES: this function not work as there is no ASYNC method using. Other fail reason may come from kernel message queue.