1 /*
2 * Copyright (C) 2015-2021 Alibaba Group Holding Limited
3 */
4
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8 #include "aos/kernel.h"
9 #include "ulog/ulog.h"
10 #if AOS_COMP_CLI
11 #include "aos/cli.h"
12 #endif
13
14 #ifdef ULOG_MOD
15 #undef ULOG_MOD
16 #endif /* ULOG_MOD */
17
18 #define ULOG_MOD "ULOG_DEMO"
19 #define TEST_STR "this is ulog tester"
20
21 static char show_log_list_buffer[512];
22
ulog_example(int argc,char ** argv)23 void ulog_example(int argc, char **argv)
24 {
25 int i = 0;
26 aos_set_log_level(AOS_LL_DEBUG);
27 while (1) {
28 LOGI(ULOG_MOD, "%d-%s", i, TEST_STR);
29 i++;
30 if (10 == i) {
31 #if ULOG_CONFIG_POP_FS
32 if (0 == aos_get_ulog_list(show_log_list_buffer, sizeof(show_log_list_buffer))) {
33 LOG("Log List %s", show_log_list_buffer);
34 }
35 #endif
36 return;
37 }
38 aos_msleep(500);
39 }
40 }
41
42 #if AOS_COMP_CLI
43 /* reg args: fun, cmd, description*/
44 ALIOS_CLI_CMD_REGISTER(ulog_example, ulog_example, ulog component base example)
45 #endif
46