提交 acfe61b5 编写于 作者: armink_ztl's avatar armink_ztl

[component][ulog] Fix some comments.

上级 6a165e5c
...@@ -750,8 +750,9 @@ void ulog_hexdump(const char *tag, rt_size_t width, rt_uint8_t *buf, rt_size_t s ...@@ -750,8 +750,9 @@ void ulog_hexdump(const char *tag, rt_size_t width, rt_uint8_t *buf, rt_size_t s
* When the level is LOG_FILTER_LVL_ALL, it will remove this tag's level filer. * When the level is LOG_FILTER_LVL_ALL, it will remove this tag's level filer.
* Then all level log will resume output. * Then all level log will resume output.
* *
* @return 0: success * @return 0 : success
* -5: no memory * -5 : no memory
* -10: level is out of range
*/ */
int ulog_tag_lvl_filter_set(const char *tag, rt_uint32_t level) int ulog_tag_lvl_filter_set(const char *tag, rt_uint32_t level)
{ {
...@@ -759,7 +760,8 @@ int ulog_tag_lvl_filter_set(const char *tag, rt_uint32_t level) ...@@ -759,7 +760,8 @@ int ulog_tag_lvl_filter_set(const char *tag, rt_uint32_t level)
ulog_tag_lvl_filter_t tag_lvl = NULL; ulog_tag_lvl_filter_t tag_lvl = NULL;
int result = RT_EOK; int result = RT_EOK;
RT_ASSERT(level <= LOG_FILTER_LVL_ALL); if (level >= LOG_FILTER_LVL_ALL)
return -RT_EINVAL;
if (!ulog.init_ok) if (!ulog.init_ok)
return result; return result;
...@@ -767,7 +769,7 @@ int ulog_tag_lvl_filter_set(const char *tag, rt_uint32_t level) ...@@ -767,7 +769,7 @@ int ulog_tag_lvl_filter_set(const char *tag, rt_uint32_t level)
/* lock output */ /* lock output */
output_lock(); output_lock();
/* find the tag in list */ /* find the tag in list */
for (node = rt_slist_first(&ulog.filter.tag_lvl_list); node; node = rt_slist_next(node)) for (node = rt_slist_first(ulog_tag_lvl_list_get()); node; node = rt_slist_next(node))
{ {
tag_lvl = rt_slist_entry(node, struct ulog_tag_lvl_filter, list); tag_lvl = rt_slist_entry(node, struct ulog_tag_lvl_filter, list);
if (!rt_strncmp(tag_lvl->tag, tag, ULOG_FILTER_TAG_MAX_LEN)) if (!rt_strncmp(tag_lvl->tag, tag, ULOG_FILTER_TAG_MAX_LEN))
...@@ -785,7 +787,7 @@ int ulog_tag_lvl_filter_set(const char *tag, rt_uint32_t level) ...@@ -785,7 +787,7 @@ int ulog_tag_lvl_filter_set(const char *tag, rt_uint32_t level)
if (level == LOG_FILTER_LVL_ALL) if (level == LOG_FILTER_LVL_ALL)
{ {
/* remove current tag's level filter when input level is the lowest level */ /* remove current tag's level filter when input level is the lowest level */
rt_slist_remove(&ulog.filter.tag_lvl_list, &tag_lvl->list); rt_slist_remove(ulog_tag_lvl_list_get(), &tag_lvl->list);
rt_free(tag_lvl); rt_free(tag_lvl);
} }
else else
...@@ -806,7 +808,7 @@ int ulog_tag_lvl_filter_set(const char *tag, rt_uint32_t level) ...@@ -806,7 +808,7 @@ int ulog_tag_lvl_filter_set(const char *tag, rt_uint32_t level)
rt_memset(tag_lvl->tag, 0 , sizeof(tag_lvl->tag)); rt_memset(tag_lvl->tag, 0 , sizeof(tag_lvl->tag));
rt_strncpy(tag_lvl->tag, tag, ULOG_FILTER_TAG_MAX_LEN); rt_strncpy(tag_lvl->tag, tag, ULOG_FILTER_TAG_MAX_LEN);
tag_lvl->level = level; tag_lvl->level = level;
rt_slist_append(&ulog.filter.tag_lvl_list, &tag_lvl->list); rt_slist_append(ulog_tag_lvl_list_get(), &tag_lvl->list);
} }
else else
{ {
...@@ -840,7 +842,7 @@ rt_uint32_t ulog_tag_lvl_filter_get(const char *tag) ...@@ -840,7 +842,7 @@ rt_uint32_t ulog_tag_lvl_filter_get(const char *tag)
/* lock output */ /* lock output */
output_lock(); output_lock();
/* find the tag in list */ /* find the tag in list */
for (node = rt_slist_first(&ulog.filter.tag_lvl_list); node; node = rt_slist_next(node)) for (node = rt_slist_first(ulog_tag_lvl_list_get()); node; node = rt_slist_next(node))
{ {
tag_lvl = rt_slist_entry(node, struct ulog_tag_lvl_filter, list); tag_lvl = rt_slist_entry(node, struct ulog_tag_lvl_filter, list);
if (!rt_strncmp(tag_lvl->tag, tag, ULOG_FILTER_TAG_MAX_LEN)) if (!rt_strncmp(tag_lvl->tag, tag, ULOG_FILTER_TAG_MAX_LEN))
...@@ -1081,7 +1083,7 @@ static void ulog_filter(uint8_t argc, char **argv) ...@@ -1081,7 +1083,7 @@ static void ulog_filter(uint8_t argc, char **argv)
{ {
/* lock output */ /* lock output */
output_lock(); output_lock();
/* find the tag in list */ /* show the tag level list */
for (node = rt_slist_first(ulog_tag_lvl_list_get()); node; node = rt_slist_next(node)) for (node = rt_slist_first(ulog_tag_lvl_list_get()); node; node = rt_slist_next(node))
{ {
tag_lvl = rt_slist_entry(node, struct ulog_tag_lvl_filter, list); tag_lvl = rt_slist_entry(node, struct ulog_tag_lvl_filter, list);
...@@ -1225,7 +1227,7 @@ int ulog_init(void) ...@@ -1225,7 +1227,7 @@ int ulog_init(void)
rt_slist_init(&ulog.backend_list); rt_slist_init(&ulog.backend_list);
#ifdef ULOG_USING_FILTER #ifdef ULOG_USING_FILTER
rt_slist_init(&ulog.filter.tag_lvl_list); rt_slist_init(ulog_tag_lvl_list_get());
#endif #endif
#ifdef ULOG_USING_ASYNC_OUTPUT #ifdef ULOG_USING_ASYNC_OUTPUT
...@@ -1287,7 +1289,7 @@ void ulog_deinit(void) ...@@ -1287,7 +1289,7 @@ void ulog_deinit(void)
/* deinit tag's level filter */ /* deinit tag's level filter */
{ {
ulog_tag_lvl_filter_t tag_lvl; ulog_tag_lvl_filter_t tag_lvl;
for (node = rt_slist_first(&ulog.filter.tag_lvl_list); node; node = rt_slist_next(node)) for (node = rt_slist_first(ulog_tag_lvl_list_get()); node; node = rt_slist_next(node))
{ {
tag_lvl = rt_slist_entry(node, struct ulog_tag_lvl_filter, list); tag_lvl = rt_slist_entry(node, struct ulog_tag_lvl_filter, list);
rt_free(tag_lvl); rt_free(tag_lvl);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册