这个页面的 最新开发版本 可能比这个发布的 2.0.0rc2 版本新。

log API 参考

API 参考

int wm_log_printf(wm_log_level_t level, const char *tag, const char *format, ...)

log printf function

参数:
  • level[in] log level

  • tag[in] the log tag

  • format[in] format

返回:

size of format size

int wm_log_hex_dump(wm_log_level_t level, const char *tag, const char *name, uint8_t width, const void *data, size_t data_len)

Output log information in hexadecimal and display its ascii code string.

参数:
  • level[in] log level

  • tag[in] log TAG

  • name[in] name for hex object, it will show on log header

  • width[in] hex number for every line, such as: 16, 32

  • data[in] hex buffer

  • data_len[in] buffer size

返回:

  • WM_ERR_SUCCESS : success

  • WM_ERR_INVALID_PARAM : invalid param

int wm_log_set_level(wm_log_level_t level)

Set log level.

参数:

level[in] log level

返回:

  • WM_ERR_SUCCESS : success

wm_log_level_t wm_log_get_level(void)

Get log level.

返回:

log level

int wm_log_set_vprintf(wm_log_vprintf_t user_vprintf)

set custom vprintf

参数:

user_vprintf[in] user defined vprintf function

返回:

  • WM_ERR_SUCCESS

int wm_log_init(void)

Initialize log module.

备注

This API must be called before all other log API can be called

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

数据结构参考

enum wm_log_level_t

Description of log level.

Values:

enumerator WM_LOG_LEVEL_NONE

No log output

enumerator WM_LOG_LEVEL_ERROR

Critical errors

enumerator WM_LOG_LEVEL_WARN

warnings

enumerator WM_LOG_LEVEL_INFO

Information messages

enumerator WM_LOG_LEVEL_DEBUG

Debug informations

enumerator WM_LOG_LEVEL_VERBOSE

Extra information which is not necessary