Skip to content

Commit acfe61b

Browse files
committed
[component][ulog] Fix some comments.
1 parent 6a165e5 commit acfe61b

File tree

1 file changed

+12
-10
lines changed
  • components/utilities/ulog

1 file changed

+12
-10
lines changed

components/utilities/ulog/ulog.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -750,24 +750,26 @@ void ulog_hexdump(const char *tag, rt_size_t width, rt_uint8_t *buf, rt_size_t s
750750
* When the level is LOG_FILTER_LVL_ALL, it will remove this tag's level filer.
751751
* Then all level log will resume output.
752752
*
753-
* @return 0: success
754-
* -5: no memory
753+
* @return 0 : success
754+
* -5 : no memory
755+
* -10: level is out of range
755756
*/
756757
int ulog_tag_lvl_filter_set(const char *tag, rt_uint32_t level)
757758
{
758759
rt_slist_t *node;
759760
ulog_tag_lvl_filter_t tag_lvl = NULL;
760761
int result = RT_EOK;
761762

762-
RT_ASSERT(level <= LOG_FILTER_LVL_ALL);
763+
if (level >= LOG_FILTER_LVL_ALL)
764+
return -RT_EINVAL;
763765

764766
if (!ulog.init_ok)
765767
return result;
766768

767769
/* lock output */
768770
output_lock();
769771
/* find the tag in list */
770-
for (node = rt_slist_first(&ulog.filter.tag_lvl_list); node; node = rt_slist_next(node))
772+
for (node = rt_slist_first(ulog_tag_lvl_list_get()); node; node = rt_slist_next(node))
771773
{
772774
tag_lvl = rt_slist_entry(node, struct ulog_tag_lvl_filter, list);
773775
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)
785787
if (level == LOG_FILTER_LVL_ALL)
786788
{
787789
/* remove current tag's level filter when input level is the lowest level */
788-
rt_slist_remove(&ulog.filter.tag_lvl_list, &tag_lvl->list);
790+
rt_slist_remove(ulog_tag_lvl_list_get(), &tag_lvl->list);
789791
rt_free(tag_lvl);
790792
}
791793
else
@@ -806,7 +808,7 @@ int ulog_tag_lvl_filter_set(const char *tag, rt_uint32_t level)
806808
rt_memset(tag_lvl->tag, 0 , sizeof(tag_lvl->tag));
807809
rt_strncpy(tag_lvl->tag, tag, ULOG_FILTER_TAG_MAX_LEN);
808810
tag_lvl->level = level;
809-
rt_slist_append(&ulog.filter.tag_lvl_list, &tag_lvl->list);
811+
rt_slist_append(ulog_tag_lvl_list_get(), &tag_lvl->list);
810812
}
811813
else
812814
{
@@ -840,7 +842,7 @@ rt_uint32_t ulog_tag_lvl_filter_get(const char *tag)
840842
/* lock output */
841843
output_lock();
842844
/* find the tag in list */
843-
for (node = rt_slist_first(&ulog.filter.tag_lvl_list); node; node = rt_slist_next(node))
845+
for (node = rt_slist_first(ulog_tag_lvl_list_get()); node; node = rt_slist_next(node))
844846
{
845847
tag_lvl = rt_slist_entry(node, struct ulog_tag_lvl_filter, list);
846848
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)
10811083
{
10821084
/* lock output */
10831085
output_lock();
1084-
/* find the tag in list */
1086+
/* show the tag level list */
10851087
for (node = rt_slist_first(ulog_tag_lvl_list_get()); node; node = rt_slist_next(node))
10861088
{
10871089
tag_lvl = rt_slist_entry(node, struct ulog_tag_lvl_filter, list);
@@ -1225,7 +1227,7 @@ int ulog_init(void)
12251227
rt_slist_init(&ulog.backend_list);
12261228

12271229
#ifdef ULOG_USING_FILTER
1228-
rt_slist_init(&ulog.filter.tag_lvl_list);
1230+
rt_slist_init(ulog_tag_lvl_list_get());
12291231
#endif
12301232

12311233
#ifdef ULOG_USING_ASYNC_OUTPUT
@@ -1287,7 +1289,7 @@ void ulog_deinit(void)
12871289
/* deinit tag's level filter */
12881290
{
12891291
ulog_tag_lvl_filter_t tag_lvl;
1290-
for (node = rt_slist_first(&ulog.filter.tag_lvl_list); node; node = rt_slist_next(node))
1292+
for (node = rt_slist_first(ulog_tag_lvl_list_get()); node; node = rt_slist_next(node))
12911293
{
12921294
tag_lvl = rt_slist_entry(node, struct ulog_tag_lvl_filter, list);
12931295
rt_free(tag_lvl);

0 commit comments

Comments
 (0)