]> git.mxchange.org Git - flightgear.git/commitdiff
Avoid spamming the log output
authorThorstenB <brehmt@gmail.com>
Sat, 17 Dec 2011 14:22:50 +0000 (15:22 +0100)
committerThorstenB <brehmt@gmail.com>
Sat, 17 Dec 2011 14:22:50 +0000 (15:22 +0100)
Stop printing "State == Running" debug messages in every update loop
(makes "--log-level=debug" a lot more usable)

src/Main/CameraGroup.cxx
src/Main/WindowBuilder.cxx
src/Main/splash.cxx
src/Main/viewmgr.cxx
src/Scenery/tilemgr.cxx
src/Scenery/tilemgr.hxx

index a69cebca6ccf5e46f0646e27df42fdd37013d941..fccba809cd942015d1621f60519519ccf963d147 100644 (file)
@@ -771,7 +771,7 @@ CameraInfo* CameraGroup::buildCamera(SGPropertyNode* cameraNode)
             parentCameraIndex = i;
         }
         if (_cameras.size() <= parentCameraIndex) {
-            SG_LOG(SG_GENERAL, SG_ALERT, "CameraGroup::buildCamera: "
+            SG_LOG(SG_VIEW, SG_ALERT, "CameraGroup::buildCamera: "
                    "failed to find parent camera for relative camera!");
             return 0;
         }
@@ -896,7 +896,7 @@ CameraInfo* CameraGroup::buildGUICamera(SGPropertyNode* cameraNode,
     }
 
     if (!window) { // buildWindow can fail
-      SG_LOG(SG_GENERAL, SG_WARN, "CameraGroup::buildGUICamera: failed to build a window");
+      SG_LOG(SG_VIEW, SG_WARN, "CameraGroup::buildGUICamera: failed to build a window");
       return NULL;
     }
 
index ceb23b4612ebfcc00a04cdc5d45112b7800d6cdf..e946a2562b844f9e884923928308aee41a757441 100644 (file)
@@ -245,7 +245,7 @@ GraphicsWindow* WindowBuilder::getDefaultWindow()
             ->registerWindow(gc, defaultWindowName);
         return defaultWindow;
     } else {
-        SG_LOG(SG_GENERAL, SG_ALERT, "getDefaultWindow: failed to create GraphicsContext");
+        SG_LOG(SG_VIEW, SG_ALERT, "getDefaultWindow: failed to create GraphicsContext");
         return 0;
     }
 }
index c3a0a7d9bac81e7190760db6f3bbfd8b048dbb52..a170a31f16fbc9e0f835d2bde333eb60ac0b5c0e 100644 (file)
@@ -195,7 +195,7 @@ static osg::Node* fgCreateSplashCamera()
       tpath = globals->resolve_maybe_aircraft_path(splash_texture);
       if (tpath.isNull())
       {
-          SG_LOG( SG_GENERAL, SG_ALERT, "Cannot find splash screen file '" << splash_texture
+          SG_LOG( SG_VIEW, SG_ALERT, "Cannot find splash screen file '" << splash_texture
                   << "'. Using default." );
       }
   }
@@ -366,11 +366,11 @@ osg::Node* fgCreateSplashNode() {
 
 // Initialize the splash screen
 void fgSplashInit () {
-  SG_LOG( SG_GENERAL, SG_INFO, "Initializing splash screen" );
+  SG_LOG( SG_VIEW, SG_INFO, "Initializing splash screen" );
   globals->get_renderer()->splashinit();
 }
 
 void fgSplashProgress ( const char *text ) {
-  SG_LOG( SG_GENERAL, SG_INFO, "Splash screen progress " << text );
+  SG_LOG( SG_VIEW, SG_INFO, "Splash screen progress " << text );
   fgSetString("/sim/startup/splash-progress-text", text);
 }
index bced660b5b3c274e9414583ce646ee611fd20782..4e4417d34be8b8e4dbcb0d308bae1e3d84766bac 100644 (file)
@@ -58,7 +58,7 @@ void
 FGViewMgr::init ()
 {
   if (inited) {
-    SG_LOG(SG_GENERAL, SG_WARN, "duplicate init of view manager");
+    SG_LOG(SG_VIEW, SG_WARN, "duplicate init of view manager");
     return;
   }
   
index 363ea858b7a16c1ccac9a3096f0589bfcf12eec6..666d64b9c6f96b73cefe954811bf98747fd89c35 100644 (file)
@@ -57,6 +57,7 @@ using simgear::TileCache;
 
 FGTileMgr::FGTileMgr():
     state( Start ),
+    last_state( Running ),
     vis( 16000 ),
     _terra_sync(NULL)
 {
@@ -341,7 +342,6 @@ void FGTileMgr::update_queues()
 // disk.
 void FGTileMgr::update(double)
 {
-    SG_LOG( SG_TERRAIN, SG_DEBUG, "FGTileMgr::update()" );
     SGVec3d viewPos = globals->get_current_view()->get_view_pos();
     double vis = _visibilityMeters->getDoubleValue();
     schedule_tiles_at(SGGeod::fromCart(viewPos), vis);
@@ -373,7 +373,10 @@ int FGTileMgr::schedule_tiles_at(const SGGeod& location, double range_m)
     // do tile load scheduling.
     // Note that we need keep track of both viewer buckets and fdm buckets.
     if ( state == Running ) {
-        SG_LOG( SG_TERRAIN, SG_DEBUG, "State == Running" );
+        if (last_state != state)
+        {
+            SG_LOG( SG_TERRAIN, SG_DEBUG, "State == Running" );
+        }
         if (current_bucket != previous_bucket) {
             // We've moved to a new bucket, we need to schedule any
             // needed tiles for loading.
@@ -386,11 +389,12 @@ int FGTileMgr::schedule_tiles_at(const SGGeod& location, double range_m)
         // save bucket
         previous_bucket = current_bucket;
     } else if ( state == Start || state == Inited ) {
-        SG_LOG( SG_TERRAIN, SG_INFO, "State == Start || Inited" );
+        SG_LOG( SG_TERRAIN, SG_DEBUG, "State == Start || Inited" );
         // do not update bucket yet (position not valid in initial loop)
         state = Running;
         previous_bucket.make_bad();
     }
+    last_state = state;
 
     return 1;
 }
index 7a51f161e16861ae5afac8e5d6c0bc86047feb1c..848225b61ff753436d973f48d676a291ca52154f 100644 (file)
@@ -53,8 +53,8 @@ private:
        Running = 2
     };
 
-    load_state state;
-    
+    load_state state, last_state;
+
     // schedule a tile for loading, returns true when tile is already loaded
     bool sched_tile( const SGBucket& b, double priority,bool current_view, double request_time);