Changeset 5994 for code/branches/console/src/libraries/core/Core.cc
- Timestamp:
- Oct 27, 2009, 2:47:14 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/libraries/core/Core.cc
r5992 r5994 106 106 void setConfigValues() 107 107 { 108 #ifdef NDEBUG 109 const unsigned int defaultLevelConsole = 1; 110 const unsigned int defaultLevelLogfile = 3; 111 const unsigned int defaultLevelShell = 1; 108 #ifdef ORXONOX_RELEASE 109 const unsigned int defaultLevelLogFile = 3; 112 110 #else 113 const unsigned int defaultLevelConsole = 3; 114 const unsigned int defaultLevelLogfile = 4; 115 const unsigned int defaultLevelShell = 3; 116 #endif 117 SetConfigValue(softDebugLevelConsole_, defaultLevelConsole) 118 .description("The maximal level of debug output shown in the console") 119 .callback(this, &CoreConfiguration::debugLevelChanged); 120 SetConfigValue(softDebugLevelLogfile_, defaultLevelLogfile) 121 .description("The maximal level of debug output shown in the logfile") 122 .callback(this, &CoreConfiguration::debugLevelChanged); 123 SetConfigValue(softDebugLevelShell_, defaultLevelShell) 124 .description("The maximal level of debug output shown in the ingame shell") 125 .callback(this, &CoreConfiguration::debugLevelChanged); 111 const unsigned int defaultLevelLogFile = 4; 112 #endif 113 SetConfigValueGeneric(ConfigFileType::Settings, softDebugLevelLogFile_, "softDebugLevelLogFile", "OutputHandler", defaultLevelLogFile) 114 .description("The maximum level of debug output shown in the log file"); 115 OutputHandler::getInstance().setSoftDebugLevel(OutputHandler::logFileOutputListenerName_s, this->softDebugLevelLogFile_); 126 116 127 117 SetConfigValue(language_, Language::getInstance().defaultLanguage_) … … 131 121 .description("If true, all random actions are different each time you start the game") 132 122 .callback(this, &CoreConfiguration::initializeRandomNumberGenerator); 133 }134 135 /**136 @brief Callback function if the debug level has changed.137 */138 void debugLevelChanged()139 {140 // softDebugLevel_ is the maximum of the 3 variables141 this->softDebugLevel_ = this->softDebugLevelConsole_;142 if (this->softDebugLevelLogfile_ > this->softDebugLevel_)143 this->softDebugLevel_ = this->softDebugLevelLogfile_;144 if (this->softDebugLevelShell_ > this->softDebugLevel_)145 this->softDebugLevel_ = this->softDebugLevelShell_;146 147 OutputHandler::setSoftDebugLevel(OutputHandler::LD_All, this->softDebugLevel_);148 OutputHandler::setSoftDebugLevel(OutputHandler::LD_Console, this->softDebugLevelConsole_);149 OutputHandler::setSoftDebugLevel(OutputHandler::LD_Logfile, this->softDebugLevelLogfile_);150 OutputHandler::setSoftDebugLevel(OutputHandler::LD_Shell, this->softDebugLevelShell_);151 123 } 152 124 … … 179 151 } 180 152 181 int softDebugLevel_; //!< The debug level 182 int softDebugLevelConsole_; //!< The debug level for the console 183 int softDebugLevelLogfile_; //!< The debug level for the logfile 184 int softDebugLevelShell_; //!< The debug level for the ingame shell 153 int softDebugLevelLogFile_; //!< The debug level for the log file (belongs to OutputHandler) 185 154 std::string language_; //!< The language 186 155 bool bInitializeRandomNumberGenerator_; //!< If true, srand(time(0)) is called … … 228 197 229 198 // Set the correct log path. Before this call, /tmp (Unix) or %TEMP% (Windows) was used 230 OutputHandler::get OutStream().setLogPath(PathConfig::getLogPathString());199 OutputHandler::getInstance().setLogPath(PathConfig::getLogPathString()); 231 200 232 201 // Parse additional options file now that we know its path … … 328 297 bGraphicsLoaded_ = false; 329 298 GameMode::bShowsGraphics_s = false; 330 }331 332 /**333 @brief Returns the softDebugLevel for the given device (returns a default-value if the class is right about to be created).334 @param device The device335 @return The softDebugLevel336 */337 /*static*/ int Core::getSoftDebugLevel(OutputHandler::OutputDevice device)338 {339 switch (device)340 {341 case OutputHandler::LD_All:342 return Core::getInstance().configuration_->softDebugLevel_;343 case OutputHandler::LD_Console:344 return Core::getInstance().configuration_->softDebugLevelConsole_;345 case OutputHandler::LD_Logfile:346 return Core::getInstance().configuration_->softDebugLevelLogfile_;347 case OutputHandler::LD_Shell:348 return Core::getInstance().configuration_->softDebugLevelShell_;349 default:350 assert(0);351 return 2;352 }353 }354 355 /**356 @brief Sets the softDebugLevel for the given device. Please use this only temporary and restore the value afterwards, as it overrides the configured value.357 @param device The device358 @param level The level359 */360 /*static*/ void Core::setSoftDebugLevel(OutputHandler::OutputDevice device, int level)361 {362 if (device == OutputHandler::LD_All)363 Core::getInstance().configuration_->softDebugLevel_ = level;364 else if (device == OutputHandler::LD_Console)365 Core::getInstance().configuration_->softDebugLevelConsole_ = level;366 else if (device == OutputHandler::LD_Logfile)367 Core::getInstance().configuration_->softDebugLevelLogfile_ = level;368 else if (device == OutputHandler::LD_Shell)369 Core::getInstance().configuration_->softDebugLevelShell_ = level;370 371 OutputHandler::setSoftDebugLevel(device, level);372 299 } 373 300
Note: See TracChangeset
for help on using the changeset viewer.