Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 20, 2011, 5:24:52 AM (13 years ago)
Author:
rgrieder
Message:

Sorted out log level handling on startup and transferred its control back to Core.

File:
1 edited

Legend:

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

    r8517 r8518  
    232232    }
    233233
     234    namespace DefaultLogLevels
     235    {
     236        struct List
     237        {
     238            OutputLevel::Value logFile;
     239            OutputLevel::Value ioConsole;
     240            OutputLevel::Value inGameConsole;
     241        };
     242
     243        using namespace OutputLevel;
     244        static const List Dev  = { Debug, Info,  Info  };
     245        static const List User = { Info,  Error, Error };
     246    }
     247
    234248    //! Function to collect the SetConfigValue-macro calls.
    235249    void Core::setConfigValues()
    236250    {
    237 #ifdef ORXONOX_RELEASE
    238         const unsigned int defaultLevelLogFile = 3;
    239 #else
    240         const unsigned int defaultLevelLogFile = 4;
    241 #endif
    242         SetConfigValueExternal(softDebugLevelLogFile_, "OutputHandler", "softDebugLevelLogFile", defaultLevelLogFile)
    243             .description("The maximum level of debug output shown in the log file");
    244         OutputHandler::getInstance().setSoftDebugLevel("LogFile", this->softDebugLevelLogFile_);
     251        // Choose the default levels according to the path Orxonox was started (build directory or not)
     252        DefaultLogLevels::List defaultLogLevels = (PathConfig::buildDirectoryRun() ? DefaultLogLevels::Dev : DefaultLogLevels::User);
     253
     254        SetConfigValueExternal(debugLevelLogFile_, "OutputHandler", "debugLevelLogFile_", defaultLogLevels.logFile)
     255            .description("The maximum level of debug output written to the log file");
     256        OutputHandler::getInstance().setSoftDebugLevel("LogFile", debugLevelLogFile_);
     257
     258        SetConfigValueExternal(debugLevelIOConsole_, "OutputHandler", "debugLevelIOConsole_", defaultLogLevels.ioConsole)
     259            .description("The maximum level of debug output shown in the IO console");
     260        OutputHandler::getInstance().setSoftDebugLevel("IOConsole", debugLevelIOConsole_);
     261        // In case we don't start the IOConsole, also configure that simple listener
     262        OutputHandler::getInstance().setSoftDebugLevel("Console", debugLevelIOConsole_);
     263
     264        SetConfigValueExternal(debugLevelIOConsole_, "OutputHandler", "debugLevelInGameConsole_", defaultLogLevels.inGameConsole)
     265            .description("The maximum level of debug output shown in the in-game console");
     266        OutputHandler::getInstance().setSoftDebugLevel("InGameConsole", debugLevelInGameConsole_);
    245267
    246268        SetConfigValue(bDevMode_, PathConfig::buildDirectoryRun())
Note: See TracChangeset for help on using the changeset viewer.