1
0
Fork 0

Allow the log-level to be set as early as possible

This commit is contained in:
ehofman 2003-09-22 09:31:36 +00:00
parent 7d6cafba6e
commit 591cfcedfb

View 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;
}