From: david Date: Mon, 24 Nov 2003 17:59:10 +0000 (+0000) Subject: Try to coordinate between the different logging idioms of JSBSim and X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5fa04adf68772ebf5d0a84e8175e24a84823d7a7;p=flightgear.git Try to coordinate between the different logging idioms of JSBSim and FlightGear: when FlightGear wants things quiet, make JSBSim quiet as well. --- diff --git a/src/FDM/JSBSim/JSBSim.cxx b/src/FDM/JSBSim/JSBSim.cxx index 936f1108e..e893c58b0 100644 --- a/src/FDM/JSBSim/JSBSim.cxx +++ b/src/FDM/JSBSim/JSBSim.cxx @@ -76,8 +76,33 @@ FGJSBsim::FGJSBsim( double dt ) { bool result; + // Set up the debugging level + // FIXME: this will not respond to + // runtime changes + + // if flight is excluded, don't bother + if ((logbuf::get_log_classes() & SG_FLIGHT) != 0) { + + // do a rough-and-ready mapping to + // the levels documented in FGFDMExec.h + switch (logbuf::get_log_priority()) { + case SG_BULK: + FGJSBBase::debug_lvl = 0x1f; + break; + case SG_DEBUG: + FGJSBBase::debug_lvl = 0x0f; + case SG_INFO: + FGJSBBase::debug_lvl = 0x01; + break; + case SG_WARN: + case SG_ALERT: + FGJSBBase::debug_lvl = 0x00; + break; + } + } + fdmex = new FGFDMExec( (FGPropertyManager*)globals->get_props() ); - + State = fdmex->GetState(); Atmosphere = fdmex->GetAtmosphere(); FCS = fdmex->GetFCS(); @@ -847,7 +872,8 @@ void FGJSBsim::do_trim(void) { } else { trimmed->setBoolValue(true); } - State->ReportState(); + if (FGJSBBase::debug_lvl > 0) + State->ReportState(); delete fgtrim; pitch_trim->setDoubleValue( FCS->GetPitchTrimCmd() ); throttle_trim->setDoubleValue( FCS->GetThrottleCmd(0) );