Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 27, 2007, 4:58:52 PM (17 years ago)
Author:
landauf
Message:

introduced 3 different soft debug levels: one for each output device (console, logfile, ingame-shell (to come))
all are configurable in the config file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/core/DebugLevel.cc

    r696 r699  
    3232
    3333#include "CoreIncludes.h"
    34 #include "Debug.h"
    3534#include "DebugLevel.h"
    3635
     
    5352    void DebugLevel::setConfigValues()
    5453    {
    55         SetConfigValue(softDebugLevel_, 2);
     54        SetConfigValue(softDebugLevelConsole_, 3);
     55        SetConfigValue(softDebugLevelLogfile_, 3);
     56        SetConfigValue(softDebugLevelShell_, 1);
     57
     58        // softDebugLevel_ is the maximum of the 3 variables
     59        this->softDebugLevel_ = this->softDebugLevelConsole_;
     60        if (this->softDebugLevelLogfile_ > this->softDebugLevel_)
     61            this->softDebugLevel_ = this->softDebugLevelLogfile_;
     62        if (this->softDebugLevelShell_ > this->softDebugLevel_)
     63            this->softDebugLevel_ = this->softDebugLevelShell_;
    5664    }
    5765
     
    5967        @brief Static function that holds the singleton.
    6068    */
    61     int DebugLevel::getSoftDebugLevel()
     69    int DebugLevel::getSoftDebugLevel(OutputHandler::OutputDevice device)
    6270    {
    6371        static bool bCreatingSoftDebugLevelObject = true;   // Static variable - used to enhance the performance
     
    6775        // If bReturnSoftDebugLevel is true, the instance of DebugLevel was created (it's set to true at the end of the constructor, call by reference)
    6876        if (bReturnSoftDebugLevel)
    69             return theOnlyDebugLevelObject->softDebugLevel_;
     77        {
     78            if (device == OutputHandler::LD_All)
     79                return theOnlyDebugLevelObject->softDebugLevel_;
     80            else if (device == OutputHandler::LD_Console)
     81                return theOnlyDebugLevelObject->softDebugLevelConsole_;
     82            else if (device == OutputHandler::LD_Logfile)
     83                return theOnlyDebugLevelObject->softDebugLevelLogfile_;
     84            else if (device == OutputHandler::LD_Shell)
     85                return theOnlyDebugLevelObject->softDebugLevelShell_;
     86        }
    7087
    7188        // If bCreatingSoftDebugLevelObject is true, we're just about to create an instance of the DebugLevel class
     
    7491            bCreatingSoftDebugLevelObject = false;
    7592            theOnlyDebugLevelObject = new DebugLevel(bReturnSoftDebugLevel);
    76             return theOnlyDebugLevelObject->softDebugLevel_;
     93            return getSoftDebugLevel(device);
    7794        }
    7895
Note: See TracChangeset for help on using the changeset viewer.