Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8796 for code/branches/output


Ignore:
Timestamp:
Jul 30, 2011, 12:54:55 AM (13 years ago)
Author:
landauf
Message:

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)

Location:
code/branches/output/src/libraries
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/output/src/libraries/core/Core.cc

    r8788 r8796  
    5151#endif
    5252
     53#include <boost/preprocessor/stringize.hpp>
     54
    5355#include "util/Clock.h"
    5456#include "util/Output.h"
    5557#include "util/Exception.h"
     58#include "util/output/LogWriter.h"
    5659#include "util/Scope.h"
    5760#include "util/ScopedSingletonManager.h"
     
    142145        this->signalHandler_->doCatch(PathConfig::getExecutablePathString(), PathConfig::getLogPathString() + "orxonox_crash.log");
    143146
    144         // Set the correct log path. Before this call, /tmp (Unix) or %TEMP% (Windows) was used
    145         OutputHandler::getInstance().setLogPath(PathConfig::getLogPathString());
    146 
    147147#ifdef ORXONOX_PLATFORM_WINDOWS
    148148        // limit the main thread to the first core so that QueryPerformanceCounter doesn't jump
     
    166166        RegisterRootObject(Core);
    167167        this->setConfigValues();
    168         // Rewrite the log file with the correct log levels
    169         OutputHandler::getInstance().rewriteLogFile();
     168
     169        // Set the correct log path and rewrite the log file with the correct log levels
     170        LogWriter::getInstance().setLogPath(PathConfig::getLogPathString());
    170171
    171172#if !defined(ORXONOX_PLATFORM_APPLE) && !defined(ORXONOX_USE_WINMAIN)
     
    232233    namespace DefaultLevelLogFile
    233234    {
    234         const OutputLevel::Value Dev  = OutputLevel::Debug;
    235         const OutputLevel::Value User = OutputLevel::Info;
     235#pragma message(__FILE__ "("BOOST_PP_STRINGIZE(__LINE__)") : Warning: TODO: inspect this (and remove boost include)")
     236        const OutputLevel Dev  = level::internal_info;
     237        const OutputLevel User = level::internal_info;
    236238    }
    237239
     
    240242    {
    241243        // Choose the default level according to the path Orxonox was started (build directory or not)
    242         OutputLevel::Value defaultLogLevel = (PathConfig::buildDirectoryRun() ? DefaultLevelLogFile::Dev : DefaultLevelLogFile::User);
     244        OutputLevel defaultLogLevel = (PathConfig::buildDirectoryRun() ? DefaultLevelLogFile::Dev : DefaultLevelLogFile::User);
    243245
    244246        SetConfigValueExternal(debugLevelLogFile_, "OutputHandler", "debugLevelLogFile", defaultLogLevel)
    245247            .description("The maximum level of debug output written to the log file");
    246         OutputHandler::getInstance().setSoftDebugLevel("LogFile", debugLevelLogFile_);
     248        LogWriter::getInstance().setLevelMax(this->debugLevelLogFile_);
    247249
    248250        SetConfigValue(bDevMode_, PathConfig::buildDirectoryRun())
     
    286288        else
    287289        {
    288             OutputLevel::Value level = (bDevMode_ ? DefaultLevelLogFile::Dev : DefaultLevelLogFile::User);
     290            OutputLevel level = (bDevMode_ ? DefaultLevelLogFile::Dev : DefaultLevelLogFile::User);
    289291            ModifyConfigValueExternal(debugLevelLogFile_, "debugLevelLogFile", tset, level);
    290292        }
  • code/branches/output/src/libraries/core/Core.h

    r8729 r8796  
    136136
    137137            bool                      bGraphicsLoaded_;
    138             int                       debugLevelLogFile_;          //!< The debug level for the log file (belongs to OutputHandler)
     138            OutputLevel               debugLevelLogFile_;          //!< The debug level for the log file (belongs to LogWriter)
    139139            std::string               language_;                   //!< The language
    140140            bool                      bInitRandomNumberGenerator_; //!< If true, srand(time(0)) is called
  • code/branches/output/src/libraries/core/GUIManager.cc

    r8788 r8796  
    3333#include <memory>
    3434#include <boost/bind.hpp>
     35#include <boost/preprocessor/stringize.hpp>
    3536#include <OgreRenderQueue.h>
    3637#include <OgreRenderWindow.h>
     
    101102        void logEvent(const CEGUI::String& message, CEGUI::LoggingLevel level = CEGUI::Standard)
    102103        {
    103             int orxonoxLevel = CEGUI::Standard;
     104            OutputLevel orxonoxLevel = level::debug_output;
    104105            switch (level)
    105106            {
    106                 case CEGUI::Errors:      orxonoxLevel = 1; break;
    107                 case CEGUI::Warnings:    orxonoxLevel = 2; break;
    108                 case CEGUI::Standard:    orxonoxLevel = 4; break;
    109                 case CEGUI::Informative: orxonoxLevel = 5; break;
    110                 case CEGUI::Insane:      orxonoxLevel = 6; break;
     107                case CEGUI::Errors:      orxonoxLevel = level::internal_error; break;
     108                case CEGUI::Warnings:    orxonoxLevel = level::internal_warning; break;
     109                case CEGUI::Standard:    orxonoxLevel = level::internal_status; break;
     110                case CEGUI::Informative: orxonoxLevel = level::internal_info; break;
     111                case CEGUI::Insane:      orxonoxLevel = level::verbose; break;
    111112                default: OrxAssert(false, "CEGUI log level out of range, inspect immediately!");
    112113            }
    113             OutputHandler::getOutStream(orxonoxLevel)
    114                 << "CEGUI: " << message << std::endl;
     114
     115#pragma message(__FILE__ "("BOOST_PP_STRINGIZE(__LINE__)") : Warning: TODO: use correct level (and remove boost include)")
     116            orxout(debug_output, context::cegui) << "CEGUI (level: " << level << "): " << message << endl;
    115117
    116118            CEGUI::DefaultLogger::logEvent(message, level);
     
    263265
    264266        this->oldCEGUI_ = false;
    265        
     267
    266268        // Note: No SceneManager specified yet
    267269#ifdef ORXONOX_OLD_CEGUI
     
    300302        std::auto_ptr<CEGUILogger> ceguiLogger(new CEGUILogger());
    301303        ceguiLogger->setLogFilename(PathConfig::getLogPathString() + "cegui.log");
    302         // Set the log level according to ours (translate by subtracting 1)
    303         ceguiLogger->setLoggingLevel(
    304             static_cast<LoggingLevel>(OutputHandler::getInstance().getSoftDebugLevel("logFile") - 1));
     304#pragma message(__FILE__ "("BOOST_PP_STRINGIZE(__LINE__)") : Warning: TODO: inspect this (and remove boost include)")
     305//        // Set the log level according to ours (translate by subtracting 1)
     306//        ceguiLogger->setLoggingLevel(
     307//            static_cast<LoggingLevel>(OutputHandler::getInstance().getSoftDebugLevel("logFile") - 1));
    305308        this->ceguiLogger_ = ceguiLogger.release();
    306309
  • code/branches/output/src/libraries/core/GraphicsManager.cc

    r8423 r8796  
    3535#include <boost/filesystem.hpp>
    3636#include <boost/shared_array.hpp>
     37#include <boost/preprocessor/stringize.hpp>
    3738
    3839#include <OgreFrameListener.h>
     
    396397        Ogre::LogMessageLevel lml, bool maskDebug, const std::string& logName)
    397398    {
    398         int orxonoxLevel;
     399        OutputLevel orxonoxLevel;
    399400        std::string introduction;
    400401        // Do not show caught OGRE exceptions in front
    401402        if (message.find("EXCEPTION") != std::string::npos)
    402403        {
    403             orxonoxLevel = OutputLevel::Debug;
     404            orxonoxLevel = level::internal_error;
    404405            introduction = "Ogre, caught exception: ";
    405406        }
     
    418419                break;
    419420            default:
    420                 orxonoxLevel = 0;
     421                orxonoxLevel = level::debug_output;
    421422            }
    422423            introduction = "Ogre: ";
    423424        }
    424         OutputHandler::getOutStream(orxonoxLevel)
    425             << introduction << message << std::endl;
     425#pragma message(__FILE__ "("BOOST_PP_STRINGIZE(__LINE__)") : Warning: TODO: use correct level, also for config values (and remove boost include)")
     426        orxout(debug_output, context::ogre) << "ogre (level: " << lml << "): " << introduction << message << endl;
    426427    }
    427428
  • code/branches/output/src/libraries/core/LuaState.cc

    r8788 r8796  
    3636}
    3737#include <loki/ScopeGuard.h>
     38#include <boost/preprocessor/stringize.hpp>
    3839
    3940#include "util/Output.h"
     
    238239    void LuaState::luaLog(unsigned int level, const std::string& message)
    239240    {
    240         OutputHandler::getOutStream(level) << message << std::endl;
     241#pragma message(__FILE__ "("BOOST_PP_STRINGIZE(__LINE__)") : Warning: TODO: use correct level (and remove boost include)")
     242        orxout(debug_output, context::lua) << "luaLog (level: " << level << "): " << message << endl;
    241243    }
    242244
  • code/branches/output/src/libraries/util/output/OutputDefinitions.h

    r8789 r8796  
    7575            REGISTER_OUTPUT_CONTEXT(test2);
    7676            REGISTER_OUTPUT_CONTEXT(output);
     77            REGISTER_OUTPUT_CONTEXT(cegui);
     78            REGISTER_OUTPUT_CONTEXT(ogre);
     79            REGISTER_OUTPUT_CONTEXT(lua);
     80            REGISTER_OUTPUT_CONTEXT(tcl);
    7781        }
    7882    }
Note: See TracChangeset for help on using the changeset viewer.