[Orxonox-commit 4127] r8798 - in code/branches/output/src/libraries: core util/output

landauf at orxonox.net landauf at orxonox.net
Sat Jul 30 15:55:35 CEST 2011


Author: landauf
Date: 2011-07-30 15:55:35 +0200 (Sat, 30 Jul 2011)
New Revision: 8798

Modified:
   code/branches/output/src/libraries/core/GUIManager.cc
   code/branches/output/src/libraries/core/GUIManager.h
   code/branches/output/src/libraries/core/GraphicsManager.cc
   code/branches/output/src/libraries/core/GraphicsManager.h
   code/branches/output/src/libraries/util/output/OutputDefinitions.h
Log:
adjusted output levels for ogre and cegui messages
added config value for cegui logfile

Modified: code/branches/output/src/libraries/core/GUIManager.cc
===================================================================
--- code/branches/output/src/libraries/core/GUIManager.cc	2011-07-30 08:39:33 UTC (rev 8797)
+++ code/branches/output/src/libraries/core/GUIManager.cc	2011-07-30 13:55:35 UTC (rev 8798)
@@ -32,7 +32,6 @@
 #include <fstream>
 #include <memory>
 #include <boost/bind.hpp>
-#include <boost/preprocessor/stringize.hpp>
 #include <OgreRenderQueue.h>
 #include <OgreRenderWindow.h>
 
@@ -92,6 +91,14 @@
 
 namespace orxonox
 {
+    namespace context
+    {
+        namespace
+        {
+            REGISTER_OUTPUT_CONTEXT(cegui);
+        }
+    }
+
     static void key_esc()
         { GUIManager::getInstance().keyESC(); }
     SetConsoleCommand("keyESC", &key_esc);
@@ -106,14 +113,13 @@
             {
                 case CEGUI::Errors:      orxonoxLevel = level::internal_error; break;
                 case CEGUI::Warnings:    orxonoxLevel = level::internal_warning; break;
-                case CEGUI::Standard:    orxonoxLevel = level::internal_status; break;
-                case CEGUI::Informative: orxonoxLevel = level::internal_info; break;
-                case CEGUI::Insane:      orxonoxLevel = level::verbose; break;
+                case CEGUI::Standard:    orxonoxLevel = level::verbose; break;
+                case CEGUI::Informative: orxonoxLevel = level::verbose_more; break;
+                case CEGUI::Insane:      orxonoxLevel = level::verbose_ultra; break;
                 default: OrxAssert(false, "CEGUI log level out of range, inspect immediately!");
             }
 
-#pragma message(__FILE__ "("BOOST_PP_STRINGIZE(__LINE__)") : Warning: TODO: use correct level (and remove boost include)")
-            orxout(debug_output, context::cegui) << "CEGUI (level: " << level << "): " << message << endl;
+            orxout(orxonoxLevel, context::cegui) << message << endl;
 
             CEGUI::DefaultLogger::logEvent(message, level);
         }
@@ -301,10 +307,7 @@
         // Create our own logger to specify the filepath
         std::auto_ptr<CEGUILogger> ceguiLogger(new CEGUILogger());
         ceguiLogger->setLogFilename(PathConfig::getLogPathString() + "cegui.log");
-#pragma message(__FILE__ "("BOOST_PP_STRINGIZE(__LINE__)") : Warning: TODO: inspect this (and remove boost include)")
-//        // Set the log level according to ours (translate by subtracting 1)
-//        ceguiLogger->setLoggingLevel(
-//            static_cast<LoggingLevel>(OutputHandler::getInstance().getSoftDebugLevel("logFile") - 1));
+        ceguiLogger->setLoggingLevel(static_cast<CEGUI::LoggingLevel>(this->outputLevelCeguiLog_));
         this->ceguiLogger_ = ceguiLogger.release();
 
         // Create the CEGUI system singleton
@@ -362,14 +365,21 @@
 
     void GUIManager::setConfigValues(void)
     {
-        SetConfigValue(guiScheme_, GUIManager::defaultScheme_) .description("Changes the current GUI scheme.") .callback(this, &GUIManager::changedGUIScheme);
+        SetConfigValue(guiScheme_, GUIManager::defaultScheme_).description("Changes the current GUI scheme.").callback(this, &GUIManager::changedGUIScheme);
         SetConfigValue(numScrollLines_, 1).description("How many lines to scroll in a list if the scroll wheel is used");
+        SetConfigValueExternal(outputLevelCeguiLog_, "OutputHandler", "outputLevelCeguiLog", CEGUI::Standard).description("The log level of the CEGUI log file").callback(this, &GUIManager::changedCeguiOutputLevel);
     }
 
     void GUIManager::changedGUIScheme(void)
     {
     }
 
+    void GUIManager::changedCeguiOutputLevel()
+    {
+        if (this->ceguiLogger_)
+            this->ceguiLogger_->setLoggingLevel(static_cast<CEGUI::LoggingLevel>(this->outputLevelCeguiLog_));
+    }
+
     /**
     @brief
         used to tick the GUI

Modified: code/branches/output/src/libraries/core/GUIManager.h
===================================================================
--- code/branches/output/src/libraries/core/GUIManager.h	2011-07-30 08:39:33 UTC (rev 8797)
+++ code/branches/output/src/libraries/core/GUIManager.h	2011-07-30 13:55:35 UTC (rev 8798)
@@ -151,6 +151,8 @@
         template <typename FunctionType>
         bool protectedCall(FunctionType function);
 
+        void changedCeguiOutputLevel();
+
         // keyHandler functions
         void buttonPressed (const KeyEvent& evt);
         void buttonReleased(const KeyEvent& evt);
@@ -167,35 +169,36 @@
         virtual void windowFocusChanged(bool bFocus);
 
 #ifdef ORXONOX_OLD_CEGUI
-        CEGUI::OgreCEGUIRenderer*            guiRenderer_;      //!< CEGUI's interface to the Ogre Engine
-        CEGUI::ResourceProvider*             resourceProvider_; //!< CEGUI's resource provider
+        CEGUI::OgreCEGUIRenderer*            guiRenderer_;          //!< CEGUI's interface to the Ogre Engine
+        CEGUI::ResourceProvider*             resourceProvider_;     //!< CEGUI's resource provider
 #else
-        CEGUI::OgreRenderer*                 guiRenderer_;      //!< CEGUI's interface to the Ogre Engine
-        CEGUI::OgreResourceProvider*         resourceProvider_; //!< CEGUI's resource provider
-        Ogre::RenderQueueListener*           rqListener_;       //!< RQ listener so we can draw UNDER Ogre overlays
+        CEGUI::OgreRenderer*                 guiRenderer_;          //!< CEGUI's interface to the Ogre Engine
+        CEGUI::OgreResourceProvider*         resourceProvider_;     //!< CEGUI's resource provider
+        Ogre::RenderQueueListener*           rqListener_;           //!< RQ listener so we can draw UNDER Ogre overlays
         CEGUI::OgreImageCodec*               imageCodec_;
 #endif
-        LuaState*                            luaState_;         //!< LuaState, access point to the Lua engine
-        CEGUI::LuaScriptModule*              scriptModule_;     //!< CEGUI's script module to use Lua
-        CEGUI::System*                       guiSystem_;        //!< CEGUI's main system
-        shared_ptr<ResourceInfo>             rootFileInfo_;     //!< Resource information about the root script
-        CEGUI::Logger*                       ceguiLogger_;      //!< CEGUI's logger to be able to log CEGUI errors in our log
-        CEGUI::Window*                       rootWindow_;       //!< Root node for all windows
-        CEGUI::Window*                       hudRootWindow_;    //!< Root node for the HUD sheets
-        CEGUI::Window*                       menuRootWindow_;   //!< Root node for the menu sheets (used by Lua)
-        std::map<std::string, PlayerInfo*>   players_;          //!< Stores the player (owner) for each GUI
-        Ogre::Camera*                        camera_;           //!< Camera used to render the scene with the GUI
+        LuaState*                            luaState_;             //!< LuaState, access point to the Lua engine
+        CEGUI::LuaScriptModule*              scriptModule_;         //!< CEGUI's script module to use Lua
+        CEGUI::System*                       guiSystem_;            //!< CEGUI's main system
+        shared_ptr<ResourceInfo>             rootFileInfo_;         //!< Resource information about the root script
+        CEGUI::Logger*                       ceguiLogger_;          //!< CEGUI's logger to be able to log CEGUI errors in our log
+        int                                  outputLevelCeguiLog_;  //!< CEGUI's log level
+        CEGUI::Window*                       rootWindow_;           //!< Root node for all windows
+        CEGUI::Window*                       hudRootWindow_;        //!< Root node for the HUD sheets
+        CEGUI::Window*                       menuRootWindow_;       //!< Root node for the menu sheets (used by Lua)
+        std::map<std::string, PlayerInfo*>   players_;              //!< Stores the player (owner) for each GUI
+        Ogre::Camera*                        camera_;               //!< Camera used to render the scene with the GUI
 
         /// Helper object that executes the surrogate destructor destroy()
         DestructionHelper<GUIManager>        destructionHelper_;
 
-        static GUIManager*                   singletonPtr_s;    //!< Singleton reference to GUIManager
+        static GUIManager*                   singletonPtr_s;        //!< Singleton reference to GUIManager
 
         // The used CEGUI scheme.
         static const std::string defaultScheme_;
         std::string guiScheme_;
         bool oldCEGUI_;
-        
+
         int numScrollLines_; ///< How many lines to scroll in a list if the scroll wheel is used
 
     }; // tolua_export

Modified: code/branches/output/src/libraries/core/GraphicsManager.cc
===================================================================
--- code/branches/output/src/libraries/core/GraphicsManager.cc	2011-07-30 08:39:33 UTC (rev 8797)
+++ code/branches/output/src/libraries/core/GraphicsManager.cc	2011-07-30 13:55:35 UTC (rev 8798)
@@ -34,7 +34,6 @@
 #include <sstream>
 #include <boost/filesystem.hpp>
 #include <boost/shared_array.hpp>
-#include <boost/preprocessor/stringize.hpp>
 
 #include <OgreFrameListener.h>
 #include <OgreRoot.h>
@@ -68,6 +67,14 @@
 
 namespace orxonox
 {
+    namespace context
+    {
+        namespace
+        {
+            REGISTER_OUTPUT_CONTEXT(ogre);
+        }
+    }
+
     static const std::string __CC_GraphicsManager_group = "GraphicsManager";
     static const std::string __CC_setScreenResolution_name = "setScreenResolution";
     static const std::string __CC_setFSAA_name = "setFSAA";
@@ -158,12 +165,6 @@
             .description("Comma separated list of all plugins to load.");
         SetConfigValue(ogreLogFile_,     "ogre.log")
             .description("Logfile for messages from Ogre. Use \"\" to suppress log file creation.");
-        SetConfigValue(ogreLogLevelTrivial_ , 5)
-            .description("Corresponding orxonox debug level for ogre Trivial");
-        SetConfigValue(ogreLogLevelNormal_  , 4)
-            .description("Corresponding orxonox debug level for ogre Normal");
-        SetConfigValue(ogreLogLevelCritical_, 2)
-            .description("Corresponding orxonox debug level for ogre Critical");
     }
 
     /**
@@ -409,21 +410,21 @@
             switch (lml)
             {
             case Ogre::LML_TRIVIAL:
-                orxonoxLevel = this->ogreLogLevelTrivial_;
+                orxonoxLevel = level::verbose_more;
                 break;
             case Ogre::LML_NORMAL:
-                orxonoxLevel = this->ogreLogLevelNormal_;
+                orxonoxLevel = level::verbose;
                 break;
             case Ogre::LML_CRITICAL:
-                orxonoxLevel = this->ogreLogLevelCritical_;
+                orxonoxLevel = level::internal_warning;
                 break;
             default:
                 orxonoxLevel = level::debug_output;
             }
             introduction = "Ogre: ";
         }
-#pragma message(__FILE__ "("BOOST_PP_STRINGIZE(__LINE__)") : Warning: TODO: use correct level, also for config values (and remove boost include)")
-        orxout(debug_output, context::ogre) << "ogre (level: " << lml << "): " << introduction << message << endl;
+
+        orxout(orxonoxLevel, context::ogre) << introduction << message << endl;
     }
 
     size_t GraphicsManager::getRenderWindowHandle()

Modified: code/branches/output/src/libraries/core/GraphicsManager.h
===================================================================
--- code/branches/output/src/libraries/core/GraphicsManager.h	2011-07-30 08:39:33 UTC (rev 8797)
+++ code/branches/output/src/libraries/core/GraphicsManager.h	2011-07-30 13:55:35 UTC (rev 8798)
@@ -133,9 +133,6 @@
         std::string         ogreConfigFile_;           //!< ogre config filename
         std::string         ogrePlugins_;              //!< Comma separated list of all plugins to load
         std::string         ogreLogFile_;              //!< log filename for Ogre log messages
-        int                 ogreLogLevelTrivial_;      //!< Corresponding Orxonox debug level for LL_TRIVIAL
-        int                 ogreLogLevelNormal_;       //!< Corresponding Orxonox debug level for LL_NORMAL
-        int                 ogreLogLevelCritical_;     //!< Corresponding Orxonox debug level for LL_CRITICAL
 
         /// Helper object that executes the surrogate destructor destroy()
         DestructionHelper<GraphicsManager> destructionHelper_;

Modified: code/branches/output/src/libraries/util/output/OutputDefinitions.h
===================================================================
--- code/branches/output/src/libraries/util/output/OutputDefinitions.h	2011-07-30 08:39:33 UTC (rev 8797)
+++ code/branches/output/src/libraries/util/output/OutputDefinitions.h	2011-07-30 13:55:35 UTC (rev 8798)
@@ -74,8 +74,6 @@
             REGISTER_OUTPUT_CONTEXT(test1);
             REGISTER_OUTPUT_CONTEXT(test2);
             REGISTER_OUTPUT_CONTEXT(output);
-            REGISTER_OUTPUT_CONTEXT(cegui);
-            REGISTER_OUTPUT_CONTEXT(ogre);
             REGISTER_OUTPUT_CONTEXT(lua);
             REGISTER_OUTPUT_CONTEXT(tcl);
         }




More information about the Orxonox-commit mailing list