You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2018/12/05 09:31:26 UTC

[mynewt-core] 04/04: sys/log: Add option to list available logs via cli

This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit f5025829bbc414d17eb0d6958a3e42d22f41af01
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Tue Dec 4 17:03:15 2018 +0100

    sys/log: Add option to list available logs via cli
    
    Use 'log -l' for this.
---
 sys/log/full/src/log_shell.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sys/log/full/src/log_shell.c b/sys/log/full/src/log_shell.c
index 56812f3..0252552 100644
--- a/sys/log/full/src/log_shell.c
+++ b/sys/log/full/src/log_shell.c
@@ -214,8 +214,11 @@ shell_log_dump_cmd(int argc, char **argv)
     struct log *log;
     struct log_offset log_offset;
     bool last = false;
+    bool list_only;
     int rc;
 
+    list_only = ((argc > 1) && !strcmp(argv[1], "-l"));
+
     log = NULL;
     do {
         log = log_list_get_next(log);
@@ -227,6 +230,11 @@ shell_log_dump_cmd(int argc, char **argv)
             continue;
         }
 
+        if (list_only) {
+            console_printf("%s\n", log->l_name);
+            continue;
+        }
+
         if (argc > 1) {
             if (strcmp(log->l_name, argv[1])) {
                 continue;