这是最新(主)开发分支的文档。如果您正在查找以前版本的文档,使用左侧的下拉菜单选择所需的版本。

log API 参考

API 参考

void wm_log_dump(const char *name, uint8_t width, const void *buf, uint16_t size)

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

备注

None

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

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

  • buf[in] hex buffer

  • size[in] buffer size

返回:

None

int wm_log_set_level(wm_log_level_t level)

Set log level.

参数:

level[in] log level

返回:

None

wm_log_level_t wm_log_get_level(void)

Get log level.

返回:

wm_log_level_t

int wm_log_set_tag_level(const char *tag, wm_log_level_t level)

Set log level by module tag.

Notes: tag supports the * wildcard.

参数:
  • tag[in] module tag

  • level[in] log level

返回:

None

wm_log_level_t wm_log_get_tag_level(const char *tag)

Get log level by module tag.

参数:

tag[in] module tag

返回:

wm_log_level_t

int wm_log_init(void)

Initialize log.

Attention

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

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

wm_log_error(...)

output error level log information

备注

None

参数:
  • ...[in] String format list and variable parameters

返回:

None

wm_log_warn(...)

output warning level log information

备注

None

参数:
  • ...[in] String format list and variable parameters

返回:

None

wm_log_info(...)

output info level log information

备注

None

参数:
  • ...[in] String format list and variable parameters

返回:

None

wm_log_debug(...)

output debug level log information

备注

None

参数:
  • ...[in] String format list and variable parameters

返回:

None

wm_log_verbose(...)

output verbose level log information

备注

None

参数:
  • ...[in] String format list and variable parameters

返回:

None

wm_log_raw(...)

output raw log information

备注

The log does not have a color format, and the line ending automatically adds a line break.

参数:
  • ...[in] String format list and variable parameters

返回:

None

数据结构参考

enum wm_log_level_t

Description of log level.

Values:

enumerator WM_LOG_LEVEL_NONE
enumerator WM_LOG_LEVEL_ERROR
enumerator WM_LOG_LEVEL_WARN
enumerator WM_LOG_LEVEL_INFO
enumerator WM_LOG_LEVEL_DEBUG
enumerator WM_LOG_LEVEL_VERBOSE