]> git.mxchange.org Git - flightgear.git/commitdiff
Try to coordinate between the different logging idioms of JSBSim and
authordavid <david>
Mon, 24 Nov 2003 17:59:10 +0000 (17:59 +0000)
committerdavid <david>
Mon, 24 Nov 2003 17:59:10 +0000 (17:59 +0000)
FlightGear: when FlightGear wants things quiet, make JSBSim quiet as
well.

src/FDM/JSBSim/JSBSim.cxx

index 936f1108e09ff0d46310b6935491647659185940..e893c58b02263b5f4f48fcb00b2c716e1c6368d7 100644 (file)
@@ -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) );