1
0
Fork 0

Adapt to revised logging API.

This commit is contained in:
James Turner 2013-02-06 19:05:45 +01:00
parent 0ced6a24a0
commit 7ad55a206e
2 changed files with 17 additions and 17 deletions

View file

@ -167,16 +167,16 @@ FGJSBsim::FGJSBsim( double dt )
TURBULENCE_TYPE_NAMES["ttTustin"] = FGWinds::ttTustin; TURBULENCE_TYPE_NAMES["ttTustin"] = FGWinds::ttTustin;
} }
// Set up the debugging level // Set up the debugging level
// FIXME: this will not respond to // FIXME: this will not respond to
// runtime changes // runtime changes
// if flight is excluded, don't bother // if flight is excluded, don't bother
if ((logbuf::get_log_classes() & SG_FLIGHT) != 0) { if ((sglog().get_log_classes() & SG_FLIGHT) != 0) {
// do a rough-and-ready mapping to // do a rough-and-ready mapping to
// the levels documented in FGFDMExec.h // the levels documented in FGFDMExec.h
switch (logbuf::get_log_priority()) { switch (sglog().get_log_priority()) {
case SG_BULK: case SG_BULK:
FGJSBBase::debug_lvl = 0x1f; FGJSBBase::debug_lvl = 0x1f;
break; break;

View file

@ -97,7 +97,7 @@ string loggingResult;
static const char * static const char *
getLoggingClasses () getLoggingClasses ()
{ {
sgDebugClass classes = logbuf::get_log_classes(); sgDebugClass classes = sglog().get_log_classes();
loggingResult.clear(); loggingResult.clear();
for (int i = 0; log_class_mappings[i].c != SG_UNDEFD; i++) { for (int i = 0; log_class_mappings[i].c != SG_UNDEFD; i++) {
if ((classes&log_class_mappings[i].c) > 0) { if ((classes&log_class_mappings[i].c) > 0) {
@ -113,10 +113,10 @@ getLoggingClasses ()
static void static void
addLoggingClass (const string &name) addLoggingClass (const string &name)
{ {
sgDebugClass classes = logbuf::get_log_classes(); sgDebugClass classes = sglog().get_log_classes();
for (int i = 0; log_class_mappings[i].c != SG_UNDEFD; i++) { for (int i = 0; log_class_mappings[i].c != SG_UNDEFD; i++) {
if (name == log_class_mappings[i].name) { if (name == log_class_mappings[i].name) {
logbuf::set_log_classes(sgDebugClass(classes|log_class_mappings[i].c)); sglog().set_log_classes(sgDebugClass(classes|log_class_mappings[i].c));
return; return;
} }
} }
@ -131,7 +131,7 @@ void
setLoggingClasses (const char * c) setLoggingClasses (const char * c)
{ {
string classes = c; string classes = c;
logbuf::set_log_classes(SG_NONE); sglog().set_log_classes(SG_NONE);
if (classes == "none") { if (classes == "none") {
SG_LOG(SG_GENERAL, SG_INFO, "Disabled all logging classes"); SG_LOG(SG_GENERAL, SG_INFO, "Disabled all logging classes");
@ -139,7 +139,7 @@ setLoggingClasses (const char * c)
} }
if (classes.empty() || classes == "all") { // default if (classes.empty() || classes == "all") { // default
logbuf::set_log_classes(SG_ALL); sglog().set_log_classes(SG_ALL);
SG_LOG(SG_GENERAL, SG_INFO, "Enabled all logging classes: " SG_LOG(SG_GENERAL, SG_INFO, "Enabled all logging classes: "
<< getLoggingClasses()); << getLoggingClasses());
return; return;
@ -170,7 +170,7 @@ setLoggingClasses (const char * c)
static const char * static const char *
getLoggingPriority () getLoggingPriority ()
{ {
switch (logbuf::get_log_priority()) { switch (sglog().get_log_priority()) {
case SG_BULK: case SG_BULK:
return "bulk"; return "bulk";
case SG_DEBUG: case SG_DEBUG:
@ -183,7 +183,7 @@ getLoggingPriority ()
return "alert"; return "alert";
default: default:
SG_LOG(SG_GENERAL, SG_WARN, "Internal: Unknown logging priority number: " SG_LOG(SG_GENERAL, SG_WARN, "Internal: Unknown logging priority number: "
<< logbuf::get_log_priority()); << sglog().get_log_priority());
return "unknown"; return "unknown";
} }
} }
@ -199,15 +199,15 @@ setLoggingPriority (const char * p)
return; return;
string priority = p; string priority = p;
if (priority == "bulk") { if (priority == "bulk") {
logbuf::set_log_priority(SG_BULK); sglog().set_log_priority(SG_BULK);
} else if (priority == "debug") { } else if (priority == "debug") {
logbuf::set_log_priority(SG_DEBUG); sglog().set_log_priority(SG_DEBUG);
} else if (priority.empty() || priority == "info") { // default } else if (priority.empty() || priority == "info") { // default
logbuf::set_log_priority(SG_INFO); sglog().set_log_priority(SG_INFO);
} else if (priority == "warn") { } else if (priority == "warn") {
logbuf::set_log_priority(SG_WARN); sglog().set_log_priority(SG_WARN);
} else if (priority == "alert") { } else if (priority == "alert") {
logbuf::set_log_priority(SG_ALERT); sglog().set_log_priority(SG_ALERT);
} else { } else {
SG_LOG(SG_GENERAL, SG_WARN, "Unknown logging priority " << priority); SG_LOG(SG_GENERAL, SG_WARN, "Unknown logging priority " << priority);
} }