[Orxonox-commit 4125] r8796 - in code/branches/output/src/libraries: core util/output
landauf at orxonox.net
landauf at orxonox.net
Sat Jul 30 00:54:55 CEST 2011
Author: landauf
Date: 2011-07-30 00:54:55 +0200 (Sat, 30 Jul 2011)
New Revision: 8796
Modified:
code/branches/output/src/libraries/core/Core.cc
code/branches/output/src/libraries/core/Core.h
code/branches/output/src/libraries/core/GUIManager.cc
code/branches/output/src/libraries/core/GraphicsManager.cc
code/branches/output/src/libraries/core/LuaState.cc
code/branches/output/src/libraries/util/output/OutputDefinitions.h
Log:
adjusted the rest of the code to the new output system, but some changes have to be reviewed.
all output is currently printed with debug level.
compiles again (posix console untested)
Modified: code/branches/output/src/libraries/core/Core.cc
===================================================================
--- code/branches/output/src/libraries/core/Core.cc 2011-07-29 20:26:45 UTC (rev 8795)
+++ code/branches/output/src/libraries/core/Core.cc 2011-07-29 22:54:55 UTC (rev 8796)
@@ -50,9 +50,12 @@
# undef max
#endif
+#include <boost/preprocessor/stringize.hpp>
+
#include "util/Clock.h"
#include "util/Output.h"
#include "util/Exception.h"
+#include "util/output/LogWriter.h"
#include "util/Scope.h"
#include "util/ScopedSingletonManager.h"
#include "util/SignalHandler.h"
@@ -141,9 +144,6 @@
this->signalHandler_ = new SignalHandler();
this->signalHandler_->doCatch(PathConfig::getExecutablePathString(), PathConfig::getLogPathString() + "orxonox_crash.log");
- // Set the correct log path. Before this call, /tmp (Unix) or %TEMP% (Windows) was used
- OutputHandler::getInstance().setLogPath(PathConfig::getLogPathString());
-
#ifdef ORXONOX_PLATFORM_WINDOWS
// limit the main thread to the first core so that QueryPerformanceCounter doesn't jump
// do this after ogre has initialised. Somehow Ogre changes the settings again (not through
@@ -165,9 +165,10 @@
// possibility to configure everything below here
RegisterRootObject(Core);
this->setConfigValues();
- // Rewrite the log file with the correct log levels
- OutputHandler::getInstance().rewriteLogFile();
+ // Set the correct log path and rewrite the log file with the correct log levels
+ LogWriter::getInstance().setLogPath(PathConfig::getLogPathString());
+
#if !defined(ORXONOX_PLATFORM_APPLE) && !defined(ORXONOX_USE_WINMAIN)
// Create persistent IO console
if (CommandLineParser::getValue("noIOConsole").getBool())
@@ -231,19 +232,20 @@
namespace DefaultLevelLogFile
{
- const OutputLevel::Value Dev = OutputLevel::Debug;
- const OutputLevel::Value User = OutputLevel::Info;
+#pragma message(__FILE__ "("BOOST_PP_STRINGIZE(__LINE__)") : Warning: TODO: inspect this (and remove boost include)")
+ const OutputLevel Dev = level::internal_info;
+ const OutputLevel User = level::internal_info;
}
//! Function to collect the SetConfigValue-macro calls.
void Core::setConfigValues()
{
// Choose the default level according to the path Orxonox was started (build directory or not)
- OutputLevel::Value defaultLogLevel = (PathConfig::buildDirectoryRun() ? DefaultLevelLogFile::Dev : DefaultLevelLogFile::User);
+ OutputLevel defaultLogLevel = (PathConfig::buildDirectoryRun() ? DefaultLevelLogFile::Dev : DefaultLevelLogFile::User);
SetConfigValueExternal(debugLevelLogFile_, "OutputHandler", "debugLevelLogFile", defaultLogLevel)
.description("The maximum level of debug output written to the log file");
- OutputHandler::getInstance().setSoftDebugLevel("LogFile", debugLevelLogFile_);
+ LogWriter::getInstance().setLevelMax(this->debugLevelLogFile_);
SetConfigValue(bDevMode_, PathConfig::buildDirectoryRun())
.description("Developer mode. If not set, hides some things from the user to not confuse him.")
@@ -285,7 +287,7 @@
}
else
{
- OutputLevel::Value level = (bDevMode_ ? DefaultLevelLogFile::Dev : DefaultLevelLogFile::User);
+ OutputLevel level = (bDevMode_ ? DefaultLevelLogFile::Dev : DefaultLevelLogFile::User);
ModifyConfigValueExternal(debugLevelLogFile_, "debugLevelLogFile", tset, level);
}
Modified: code/branches/output/src/libraries/core/Core.h
===================================================================
--- code/branches/output/src/libraries/core/Core.h 2011-07-29 20:26:45 UTC (rev 8795)
+++ code/branches/output/src/libraries/core/Core.h 2011-07-29 22:54:55 UTC (rev 8796)
@@ -135,7 +135,7 @@
Scope<ScopeID::Graphics>* graphicsScope_;
bool bGraphicsLoaded_;
- int debugLevelLogFile_; //!< The debug level for the log file (belongs to OutputHandler)
+ OutputLevel debugLevelLogFile_; //!< The debug level for the log file (belongs to LogWriter)
std::string language_; //!< The language
bool bInitRandomNumberGenerator_; //!< If true, srand(time(0)) is called
bool bStartIOConsole_; //!< Set to false if you don't want to use the IOConsole
Modified: code/branches/output/src/libraries/core/GUIManager.cc
===================================================================
--- code/branches/output/src/libraries/core/GUIManager.cc 2011-07-29 20:26:45 UTC (rev 8795)
+++ code/branches/output/src/libraries/core/GUIManager.cc 2011-07-29 22:54:55 UTC (rev 8796)
@@ -32,6 +32,7 @@
#include <fstream>
#include <memory>
#include <boost/bind.hpp>
+#include <boost/preprocessor/stringize.hpp>
#include <OgreRenderQueue.h>
#include <OgreRenderWindow.h>
@@ -100,19 +101,20 @@
public:
void logEvent(const CEGUI::String& message, CEGUI::LoggingLevel level = CEGUI::Standard)
{
- int orxonoxLevel = CEGUI::Standard;
+ OutputLevel orxonoxLevel = level::debug_output;
switch (level)
{
- case CEGUI::Errors: orxonoxLevel = 1; break;
- case CEGUI::Warnings: orxonoxLevel = 2; break;
- case CEGUI::Standard: orxonoxLevel = 4; break;
- case CEGUI::Informative: orxonoxLevel = 5; break;
- case CEGUI::Insane: orxonoxLevel = 6; break;
+ 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;
default: OrxAssert(false, "CEGUI log level out of range, inspect immediately!");
}
- OutputHandler::getOutStream(orxonoxLevel)
- << "CEGUI: " << message << std::endl;
+#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;
+
CEGUI::DefaultLogger::logEvent(message, level);
}
@@ -262,7 +264,7 @@
COUT(3) << "Initialising CEGUI." << std::endl;
this->oldCEGUI_ = false;
-
+
// Note: No SceneManager specified yet
#ifdef ORXONOX_OLD_CEGUI
guiRenderer_ = new OgreCEGUIRenderer(GraphicsManager::getInstance().getRenderWindow(), Ogre::RENDER_QUEUE_OVERLAY, false, 3000);
@@ -299,9 +301,10 @@
// Create our own logger to specify the filepath
std::auto_ptr<CEGUILogger> ceguiLogger(new CEGUILogger());
ceguiLogger->setLogFilename(PathConfig::getLogPathString() + "cegui.log");
- // Set the log level according to ours (translate by subtracting 1)
- ceguiLogger->setLoggingLevel(
- static_cast<LoggingLevel>(OutputHandler::getInstance().getSoftDebugLevel("logFile") - 1));
+#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));
this->ceguiLogger_ = ceguiLogger.release();
// Create the CEGUI system singleton
Modified: code/branches/output/src/libraries/core/GraphicsManager.cc
===================================================================
--- code/branches/output/src/libraries/core/GraphicsManager.cc 2011-07-29 20:26:45 UTC (rev 8795)
+++ code/branches/output/src/libraries/core/GraphicsManager.cc 2011-07-29 22:54:55 UTC (rev 8796)
@@ -34,6 +34,7 @@
#include <sstream>
#include <boost/filesystem.hpp>
#include <boost/shared_array.hpp>
+#include <boost/preprocessor/stringize.hpp>
#include <OgreFrameListener.h>
#include <OgreRoot.h>
@@ -395,12 +396,12 @@
void GraphicsManager::messageLogged(const std::string& message,
Ogre::LogMessageLevel lml, bool maskDebug, const std::string& logName)
{
- int orxonoxLevel;
+ OutputLevel orxonoxLevel;
std::string introduction;
// Do not show caught OGRE exceptions in front
if (message.find("EXCEPTION") != std::string::npos)
{
- orxonoxLevel = OutputLevel::Debug;
+ orxonoxLevel = level::internal_error;
introduction = "Ogre, caught exception: ";
}
else
@@ -417,12 +418,12 @@
orxonoxLevel = this->ogreLogLevelCritical_;
break;
default:
- orxonoxLevel = 0;
+ orxonoxLevel = level::debug_output;
}
introduction = "Ogre: ";
}
- OutputHandler::getOutStream(orxonoxLevel)
- << introduction << message << std::endl;
+#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;
}
size_t GraphicsManager::getRenderWindowHandle()
Modified: code/branches/output/src/libraries/core/LuaState.cc
===================================================================
--- code/branches/output/src/libraries/core/LuaState.cc 2011-07-29 20:26:45 UTC (rev 8795)
+++ code/branches/output/src/libraries/core/LuaState.cc 2011-07-29 22:54:55 UTC (rev 8796)
@@ -35,6 +35,7 @@
#include <lualib.h>
}
#include <loki/ScopeGuard.h>
+#include <boost/preprocessor/stringize.hpp>
#include "util/Output.h"
#include "util/Exception.h"
@@ -237,7 +238,8 @@
void LuaState::luaLog(unsigned int level, const std::string& message)
{
- OutputHandler::getOutStream(level) << message << std::endl;
+#pragma message(__FILE__ "("BOOST_PP_STRINGIZE(__LINE__)") : Warning: TODO: use correct level (and remove boost include)")
+ orxout(debug_output, context::lua) << "luaLog (level: " << level << "): " << message << endl;
}
bool LuaState::fileExists(const std::string& filename)
Modified: code/branches/output/src/libraries/util/output/OutputDefinitions.h
===================================================================
--- code/branches/output/src/libraries/util/output/OutputDefinitions.h 2011-07-29 20:26:45 UTC (rev 8795)
+++ code/branches/output/src/libraries/util/output/OutputDefinitions.h 2011-07-29 22:54:55 UTC (rev 8796)
@@ -74,6 +74,10 @@
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