]> git.mxchange.org Git - flightgear.git/commitdiff
Allow the log-level to be set as early as possible
authorehofman <ehofman>
Mon, 22 Sep 2003 09:31:36 +0000 (09:31 +0000)
committerehofman <ehofman>
Mon, 22 Sep 2003 09:31:36 +0000 (09:31 +0000)
src/Main/options.cxx

index 58901152bf4a9e0025b2a13deacbe6ee604ca3b5..446bedc8adfb89b09f259319cdf3690c3d0d51d4 100644 (file)
@@ -961,6 +961,23 @@ fgOptLogLevel( const char *arg )
 {
     fgSetString("/sim/logging/classes", "all");
     fgSetString("/sim/logging/priority", arg);
+
+    string priority = arg;
+    if (priority == "bulk") {
+      logbuf::set_log_priority(SG_BULK);
+    } else if (priority == "debug") {
+      logbuf::set_log_priority(SG_DEBUG);
+    } else if (priority.empty() || priority == "info") { // default
+      logbuf::set_log_priority(SG_INFO);
+    } else if (priority == "warn") {
+      logbuf::set_log_priority(SG_WARN);
+    } else if (priority == "alert") {
+      logbuf::set_log_priority(SG_ALERT);
+    } else {
+      SG_LOG(SG_GENERAL, SG_WARN, "Unknown logging priority " << priority);
+    }
+    SG_LOG(SG_GENERAL, SG_INFO, "Logging priority is " << priority);
+
     return FG_OPTIONS_OK;
 }