]> sigrok.org Git - pulseview.git/commitdiff
Main: Add -s option to allow logging to console as before
authorSoeren Apel <redacted>
Fri, 30 Mar 2018 08:26:34 +0000 (10:26 +0200)
committerUwe Hermann <redacted>
Fri, 30 Mar 2018 18:20:11 +0000 (20:20 +0200)
main.cpp

index feff17aaf47cd54299ff114871e32247aceedce1..e3bf8835c665b60b04d5c7302ff8b9ad3432a7c9 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -92,6 +92,7 @@ void usage()
                "  -i, --input-file                Load input from file\n"
                "  -I, --input-format              Input format\n"
                "  -c, --clean                     Don't restore previous sessions on startup\n"
+               "  -s, --log-to-stdout             Don't use logging, output to stdout instead\n"
                "\n", PV_BIN_NAME);
 }
 
@@ -102,6 +103,7 @@ int main(int argc, char *argv[])
        string open_file, open_file_format, driver;
        bool restore_sessions = true;
        bool do_scan = true;
+       bool do_logging = true;
 
        Application a(argc, argv);
 
@@ -121,11 +123,12 @@ int main(int argc, char *argv[])
                        {"input-file", required_argument, nullptr, 'i'},
                        {"input-format", required_argument, nullptr, 'I'},
                        {"clean", no_argument, nullptr, 'c'},
+                       {"log-to-stdout", no_argument, nullptr, 's'},
                        {nullptr, 0, nullptr, 0}
                };
 
                const int c = getopt_long(argc, argv,
-                       "l:Vhc?d:Di:I:", long_options, nullptr);
+                       "h?VDcsl:d:i:I:", long_options, nullptr);
                if (c == -1)
                        break;
 
@@ -180,6 +183,10 @@ int main(int argc, char *argv[])
                case 'c':
                        restore_sessions = false;
                        break;
+
+               case 's':
+                       do_logging = false;
+                       break;
                }
        }
 
@@ -195,7 +202,8 @@ int main(int argc, char *argv[])
        pv::GlobalSettings settings;
        settings.set_defaults_where_needed();
 
-       pv::logging.init();
+       if (do_logging)
+               pv::logging.init();
 
        // Initialise libsigrok
        context = sigrok::Context::create();