Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 23, 2011, 12:45:53 AM (13 years ago)
Author:
landauf
Message:

merged output branch back to trunk.

Changes:

  • you have to include util/Output.h instead of util/Debug.h
  • COUT(x) is now called orxout(level)
  • output levels are now defined by an enum instead of numbers. see util/Output.h for the definition
  • it's possible to use output contexts with orxout(level, context). see util/Output.h for some common contexts. you can define more contexts
  • you must use 'endl' at the end of an output message, '\n' does not flush the message

Output levels:

  • instead of COUT(0) use orxout()
  • instead of COUT(1) use orxout(user_error) or orxout(internal_error)
  • instead of COUT(2) use orxout(user_warning) or orxout(internal_warning)
  • instead of COUT(3) use orxout(user_status/user_info) or orxout(internal_status/internal_info)
  • instead of COUT(4) use orxout(verbose)
  • instead of COUT(5) use orxout(verbose_more)
  • instead of COUT(6) use orxout(verbose_ultra)

Guidelines:

  • user_* levels are for the user, visible in the console and the log-file
  • internal_* levels are for developers, visible in the log-file
  • verbose_* levels are for debugging, only visible if the context of the output is activated

Usage in C++:

  • orxout() << "message" << endl;
  • orxout(level) << "message" << endl;
  • orxout(level, context) << "message" << endl;

Usage in Lua:

  • orxout("message")
  • orxout(orxonox.level.levelname, "message")
  • orxout(orxonox.level.levelname, "context", "message")

Usage in Tcl (and in the in-game-console):

  • orxout levelname message
  • orxout_context levelname context message
  • shortcuts: log message, error message, warning message, status message, info message, debug message
Location:
code/trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/modules/questsystem/GlobalQuest.cc

    r7552 r8858  
    7171        XMLPortObject(GlobalQuest, QuestEffect, "reward-effects", addRewardEffect, getRewardEffects, xmlelement, mode);
    7272
    73         COUT(4) << "New GlobalQuest {" << this->getId() << "} created." << std::endl;
     73        orxout(verbose, context::quests) << "New GlobalQuest {" << this->getId() << "} created." << endl;
    7474    }
    7575
     
    8787        if(!this->isFailable(player)) // Check whether the Quest can be failed.
    8888        {
    89             COUT(4) << "A non-completable quest was trying to be failed." << std::endl;
     89            orxout(verbose, context::quests) << "A non-completable quest was trying to be failed." << endl;
    9090            return false;
    9191        }
     
    114114        if(!this->isCompletable(player)) // Check whether the Quest can be completed.
    115115        {
    116             COUT(4) << "A non-completable quest was trying to be completed." << std::endl;
     116            orxout(verbose, context::quests) << "A non-completable quest was trying to be completed." << endl;
    117117            return false;
    118118        }
     
    227227        this->rewards_.push_back(effect); // Add the QuestEffect to the list.
    228228
    229         COUT(4) << "Reward effect was added to Quest {" << this->getId() << "}." << std::endl;
     229        orxout(verbose, context::quests) << "Reward effect was added to Quest {" << this->getId() << "}." << endl;
    230230        return true;
    231231    }
  • code/trunk/src/modules/questsystem/LocalQuest.cc

    r7552 r8858  
    6969        SUPER(LocalQuest, XMLPort, xmlelement, mode);
    7070
    71         COUT(4) << "New LocalQuest {" << this->getId() << "} created." << std::endl;
     71        orxout(verbose, context::quests) << "New LocalQuest {" << this->getId() << "} created." << endl;
    7272    }
    7373
     
    8585        if(!this->isFailable(player)) // Checks whether the quest can be failed.
    8686        {
    87             COUT(4) << "A non-failable quest was trying to be failed." << std::endl;
     87            orxout(verbose, context::quests) << "A non-failable quest was trying to be failed." << endl;
    8888            return false;
    8989        }
     
    108108        if(!this->isCompletable(player)) // Checks whether the Quest can be completed.
    109109        {
    110             COUT(4) << "A non-completable quest was trying to be completed." << std::endl;
     110            orxout(verbose, context::quests) << "A non-completable quest was trying to be completed." << endl;
    111111            return false;
    112112        }
  • code/trunk/src/modules/questsystem/Quest.cc

    r7552 r8858  
    9696        this->parentQuest_ = quest;
    9797
    98         COUT(4) << "Parent Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
     98        orxout(verbose, context::quests) << "Parent Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << endl;
    9999        return true;
    100100    }
     
    115115        this->subQuests_.push_back(quest); // Adds the Quest to the end of the list of sub-quests.
    116116
    117         COUT(4) << "Sub Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
     117        orxout(verbose, context::quests) << "Sub Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << endl;
    118118        return true;
    119119    }
     
    135135        this->hints_.push_back(hint); // Adds the QuestHint to the end of the list of QuestHints.
    136136
    137         COUT(4) << "QuestHint {" << hint->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
     137        orxout(verbose, context::quests) << "QuestHint {" << hint->getId() << "} was added to Quest {" << this->getId() << "}." << endl;
    138138        return true;
    139139    }
     
    153153        this->failEffects_.push_back(effect); // Adds the QuestEffect to the end of the list of fail QuestEffects.
    154154
    155         COUT(4) << "A FailEffect was added to Quest {" << this->getId() << "}." << std::endl;
     155        orxout(verbose, context::quests) << "A FailEffect was added to Quest {" << this->getId() << "}." << endl;
    156156        return true;
    157157    }
     
    171171        this->completeEffects_.push_back(effect); // Adds the QuestEffect to the end of the list of complete QuestEffects.
    172172
    173         COUT(4) << "A CompleteEffect was added to Quest {" << this->getId() << "}." << std::endl;
     173        orxout(verbose, context::quests) << "A CompleteEffect was added to Quest {" << this->getId() << "}." << endl;
    174174        return true;
    175175    }
     
    341341        this->setStatus(player, QuestStatus::Failed);
    342342
    343         COUT(4) << "Quest {" << this->getId() << "} is failed for player: " << player << " ." <<std::endl;
     343        orxout(verbose, context::quests) << "Quest {" << this->getId() << "} is failed for player: " << player << " ." << endl;
    344344
    345345        this->getDescription()->sendFailQuestNotification(player);
     
    360360        this->setStatus(player, QuestStatus::Completed);
    361361
    362         COUT(4) << "Quest {" << this->getId() << "} is completed for player: " << player << " ." <<std::endl;
     362        orxout(verbose, context::quests) << "Quest {" << this->getId() << "} is completed for player: " << player << " ." << endl;
    363363
    364364        this->getDescription()->sendCompleteQuestNotification(player);
     
    378378        if(!this->isStartable(player)) // Checks whether the quest can be started.
    379379        {
    380             COUT(4) << "A non-startable quest was trying to be started." << std::endl;
     380            orxout(verbose, context::quests) << "A non-startable quest was trying to be started." << endl;
    381381            return false;
    382382        }
    383383
    384         COUT(4) << "Quest {" << this->getId() << "} is started for player: " << player << " ." <<std::endl;
     384        orxout(verbose, context::quests) << "Quest {" << this->getId() << "} is started for player: " << player << " ." << endl;
    385385
    386386        QuestListener::advertiseStatusChange(this->listeners_, "start"); // Tells the QuestListeners, that the status has changed to active.
  • code/trunk/src/modules/questsystem/QuestDescription.cc

    r8706 r8858  
    7979        XMLPortParam(QuestDescription, "completeMessage", setCompleteMessage, getCompleteMessage, xmlelement, mode);
    8080
    81         COUT(4) << "New QuestDescription with title '" << this->getTitle() << "' created." << std::endl;
     81        orxout(verbose, context::quests) << "New QuestDescription with title '" << this->getTitle() << "' created." << endl;
    8282    }
    8383
     
    109109            else
    110110            {
    111                 COUT(2) << "Bad input in notificationHelper, this should not be happening!" << std::endl;
     111                orxout(internal_warning, context::quests) << "Bad input in notificationHelper, this should not be happening!" << endl;
    112112                return false;
    113113            }
     
    115115        else
    116116        {
    117             COUT(2) << "Bad input in notificationHelper, this should not be happening!" << std::endl;
     117            orxout(internal_warning, context::quests) << "Bad input in notificationHelper, this should not be happening!" << endl;
    118118            return false;
    119119        }
  • code/trunk/src/modules/questsystem/QuestEffect.cc

    r8351 r8858  
    7070        bool temp = true;
    7171
    72         COUT(4) << "Invoking QuestEffects on player: " << player << " ."  << std::endl;
     72        orxout(verbose, context::quests) << "Invoking QuestEffects on player: " << player << " ."  << endl;
    7373
    7474        for (std::list<QuestEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)
  • code/trunk/src/modules/questsystem/QuestEffectBeacon.cc

    r8706 r8858  
    7979        XMLPortEventSink(QuestEffectBeacon, BaseObject, "execute", execute, xmlelement, mode); //TODO: Change BaseObject to MultiTrigger as soon as MultiTrigger is the base of all triggers.
    8080
    81         COUT(4) << "New QuestEffectBeacon created." << std::endl;
     81        orxout(verbose, context::quests) << "New QuestEffectBeacon created." << endl;
    8282    }
    8383
     
    108108        if(!(this->isActive())) // If the QuestEffectBeacon is inactive it cannot be executed.
    109109        {
    110             COUT(4) << "The QuestEffectBeacon is inactive." << std::endl;
     110            orxout(verbose, context::quests) << "The QuestEffectBeacon is inactive." << endl;
    111111            return false;
    112112        }
     
    128128        if(player == NULL)
    129129        {
    130             COUT(4) << "The QuestEffectBeacon was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << std::endl;
    131             return false;
    132         }
    133 
    134         COUT(4) << "QuestEffectBeacon executed on player: " << player << " ." << std::endl;
     130            orxout(verbose, context::quests) << "The QuestEffectBeacon was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << endl;
     131            return false;
     132        }
     133
     134        orxout(verbose, context::quests) << "QuestEffectBeacon executed on player: " << player << " ." << endl;
    135135
    136136        bool temp = QuestEffect::invokeEffects(player, this->effects_); // Invoke the QuestEffects on the PlayerInfo.
     
    221221        this->effects_.push_back(effect);
    222222
    223         COUT(4) << "A QuestEffect was added to a QuestEffectBeacon." << std::endl;
     223        orxout(verbose, context::quests) << "A QuestEffect was added to a QuestEffectBeacon." << endl;
    224224        return true;
    225225    }
  • code/trunk/src/modules/questsystem/QuestHint.cc

    r7552 r8858  
    7474        QuestManager::getInstance().registerHint(this); // Registers the QuestHint with the QuestManager.
    7575
    76         COUT(4) << "New QuestHint {" << this->getId() << "} created." << std::endl;
     76        orxout(verbose, context::quests) << "New QuestHint {" << this->getId() << "} created." << endl;
    7777    }
    7878
     
    120120            else
    121121            {
    122                 COUT(4) << "An already active questHint was trying to get activated." << std::endl;
     122                orxout(verbose, context::quests) << "An already active questHint was trying to get activated." << endl;
    123123                return false;
    124124            }
    125125        }
    126126
    127         COUT(4) << "A hint of a non-active quest was trying to get activated." << std::endl;
     127        orxout(verbose, context::quests) << "A hint of a non-active quest was trying to get activated." << endl;
    128128        return false;
    129129    }
  • code/trunk/src/modules/questsystem/QuestItem.cc

    r8079 r8858  
    8989        if(id == "") // Checks whether the id is a valid id.
    9090        {
    91             COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
     91            orxout(internal_warning, context::quests) << "Invalid id. QuestItem id {" << id << "} could not be set." << endl;
    9292            return;
    9393        }
  • code/trunk/src/modules/questsystem/QuestListener.cc

    r7462 r8858  
    8484            this->quest_->addListener(this); // Adds the QuestListener to the Quests list of listeners.
    8585
    86         COUT(4) << "QuestListener created for quest: {" << this->quest_->getId() << "} with mode '" << this->getMode() << "'." << std::endl;
     86        orxout(verbose, context::quests) << "QuestListener created for quest: {" << this->quest_->getId() << "} with mode '" << this->getMode() << "'." << endl;
    8787    }
    8888
     
    146146        else
    147147        {
    148             COUT(2) << "QuestListener with invalid mode '" << mode << "' created. Mode set to 'all'." << std::endl;
     148            orxout(internal_warning, context::quests) << "QuestListener with invalid mode '" << mode << "' created. Mode set to 'all'." << endl;
    149149            this->mode_ = QuestListenerMode::All;
    150150            return false;
  • code/trunk/src/modules/questsystem/QuestManager.cc

    r8729 r8858  
    6161        RegisterRootObject(QuestManager);
    6262
    63         COUT(3) << "QuestManager created." << std::endl;
     63        orxout(internal_info, context::quests) << "QuestManager created." << endl;
    6464    }
    6565
     
    7070    QuestManager::~QuestManager()
    7171    {
    72         COUT(3) << "QuestManager destroyed." << std::endl;
     72        orxout(internal_info, context::quests) << "QuestManager destroyed." << endl;
    7373    }
    7474
     
    103103        {
    104104            quest->setRegistered();
    105             COUT(4) << "Quest with questId {" << quest->getId() << "} successfully inserted." << std::endl;
     105            orxout(verbose, context::quests) << "Quest with questId {" << quest->getId() << "} successfully inserted." << endl;
    106106            return true;
    107107        }
    108108        else
    109109        {
    110            COUT(2) << "Quest with the same id was already present." << std::endl;
     110           orxout(internal_warning, context::quests) << "Quest with the same id was already present." << endl;
    111111           return false;
    112112        }
     
    141141        {
    142142            hint->setRegistered();
    143             COUT(4) << "QuestHint with hintId {" << hint->getId() << "} successfully inserted." << std::endl;
     143            orxout(verbose, context::quests) << "QuestHint with hintId {" << hint->getId() << "} successfully inserted." << endl;
    144144            return true;
    145145        }
    146146        else
    147147        {
    148            COUT(2) << "QuestHint with the same id was already present." << std::endl;
     148           orxout(internal_warning, context::quests) << "QuestHint with the same id was already present." << endl;
    149149           return false;
    150150        }
     
    183183        {
    184184           quest = NULL;
    185            COUT(2) << "The quest with id {" << questId << "} is nowhere to be found." << std::endl;
     185           orxout(internal_warning, context::quests) << "The quest with id {" << questId << "} is nowhere to be found." << endl;
    186186        }
    187187
     
    212212        {
    213213           hint = NULL;
    214            COUT(2) << "The hint with id {" << hintId << "} is nowhere to be found." << std::endl;
     214           orxout(internal_warning, context::quests) << "The hint with id {" << hintId << "} is nowhere to be found." << endl;
    215215        }
    216216
     
    431431        if(player == NULL)
    432432        {
    433             COUT(1) << "Error: GUIOverlay with name '" << guiName << "' has no player." << std::endl;
     433            orxout(internal_error, context::quests) << "GUIOverlay with name '" << guiName << "' has no player." << endl;
    434434            return NULL;
    435435        }
  • code/trunk/src/modules/questsystem/effects/AddQuest.cc

    r7552 r8858  
    7070        SUPER(AddQuest, XMLPort, xmlelement, mode);
    7171
    72         COUT(4) << "New AddQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
     72        orxout(verbose, context::quests) << "New AddQuest, with target Quest {" << this->getQuestId() << "}, created." << endl;
    7373    }
    7474
     
    8585        assert(player);
    8686
    87         COUT(5) << "AddQuest on player: " << player << " ." << std::endl;
     87        orxout(verbose_more, context::quests) << "AddQuest on player: " << player << " ." << endl;
    8888
    8989        try
     
    9595        catch(const orxonox::Exception& ex)
    9696        {
    97             COUT(2) << ex.getFullDescription() << std::endl;
     97            orxout(internal_warning, context::quests) << ex.getFullDescription() << endl;
    9898            return false;
    9999        }
    100100
    101         COUT(4) << "Quest {" << this->getQuestId() << "} successfully added to player: " << player << " ." << std::endl;
     101        orxout(verbose, context::quests) << "Quest {" << this->getQuestId() << "} successfully added to player: " << player << " ." << endl;
    102102        return true;
    103103    }
  • code/trunk/src/modules/questsystem/effects/AddQuestHint.cc

    r8079 r8858  
    7373        XMLPortParam(AddQuestHint, "hintId", setHintId, getHintId, xmlelement, mode);
    7474
    75         COUT(4) << "New AddQuestHint, with target QuestHint {" << this->getHintId() << "}, created." << std::endl;
     75        orxout(verbose, context::quests) << "New AddQuestHint, with target QuestHint {" << this->getHintId() << "}, created." << endl;
    7676    }
    7777
     
    8888        if(id == "")
    8989        {
    90             COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
     90            orxout(internal_warning, context::quests) << "Invalid id. QuestItem id {" << id << "} could not be set." << endl;
    9191            return false;
    9292        }
     
    108108        assert(player);
    109109
    110         COUT(5) << "AddQuestHint on player: " << player << " ." << std::endl;
     110        orxout(verbose_more, context::quests) << "AddQuestHint on player: " << player << " ." << endl;
    111111
    112112        try
     
    118118        catch(const Exception& e)
    119119        {
    120            COUT(2) << e.getFullDescription() << std::endl;
     120           orxout(internal_warning, context::quests) << e.getFullDescription() << endl;
    121121           return false;
    122122        }
    123123
    124         COUT(4) << "QuestHint {" << this->getHintId() << "} successfully added to player: " << player << " ." << std::endl;
     124        orxout(verbose, context::quests) << "QuestHint {" << this->getHintId() << "} successfully added to player: " << player << " ." << endl;
    125125        return true;
    126126
  • code/trunk/src/modules/questsystem/effects/AddReward.cc

    r8351 r8858  
    7070        XMLPortObject(AddReward, Rewardable, "", addRewardable, getRewardables, xmlelement, mode);
    7171
    72         COUT(4) << "New AddReward, with " << this->rewards_.size() << " Rewardables created." << std::endl;
     72        orxout(verbose, context::quests) << "New AddReward, with " << this->rewards_.size() << " Rewardables created." << endl;
    7373    }
    7474
     
    103103    bool AddReward::invoke(PlayerInfo* player)
    104104    {
    105         COUT(5) << "AddReward on player: " << player << " ." << std::endl;
     105        orxout(verbose_more, context::quests) << "AddReward on player: " << player << " ." << endl;
    106106
    107107        bool temp = true;
     
    109109            temp = temp && (*reward)->reward(player);
    110110
    111         COUT(4) << "Rewardable successfully added to player." << player << " ." << std::endl;
     111        orxout(verbose, context::quests) << "Rewardable successfully added to player." << player << " ." << endl;
    112112
    113113        return temp;
  • code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.cc

    r8079 r8858  
    8383        if(id == "")
    8484        {
    85             COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
     85            orxout(internal_warning, context::quests) << "Invalid id. QuestItem id {" << id << "} could not be set." << endl;
    8686            return false;
    8787        }
  • code/trunk/src/modules/questsystem/effects/CompleteQuest.cc

    r7552 r8858  
    7070        SUPER(CompleteQuest, XMLPort, xmlelement, mode);
    7171
    72         COUT(4) << "New CompleteQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
     72        orxout(verbose, context::quests) << "New CompleteQuest, with target Quest {" << this->getQuestId() << "}, created." << endl;
    7373    }
    7474
     
    8585        assert(player);
    8686
    87         COUT(5) << "CompleteQuest on player: " << player << " ." << std::endl;
     87        orxout(verbose_more, context::quests) << "CompleteQuest on player: " << player << " ." << endl;
    8888
    8989        Quest* quest;
     
    9797        catch(const Exception& e)
    9898        {
    99             COUT(2) << e.getFullDescription() << std::endl;
     99            orxout(internal_warning, context::quests) << e.getFullDescription() << endl;
    100100            return false;
    101101        }
    102102
    103         COUT(4) << "Quest {" << quest->getId() << "} successfully completed by player: " << player << " ." << std::endl;
     103        orxout(verbose, context::quests) << "Quest {" << quest->getId() << "} successfully completed by player: " << player << " ." << endl;
    104104        return true;
    105105    }
  • code/trunk/src/modules/questsystem/effects/FailQuest.cc

    r7552 r8858  
    7070        SUPER(FailQuest, XMLPort, xmlelement, mode);
    7171
    72         COUT(4) << "New FailQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
     72        orxout(verbose, context::quests) << "New FailQuest, with target Quest {" << this->getQuestId() << "}, created." << endl;
    7373    }
    7474
     
    8585        assert(player);
    8686
    87         COUT(4) << "FailQuest on player: " << player << " ." << std::endl;
     87        orxout(verbose, context::quests) << "FailQuest on player: " << player << " ." << endl;
    8888
    8989        Quest* quest;
     
    9696        catch(const Exception& e)
    9797        {
    98             COUT(2) << e.getFullDescription() << std::endl;
     98            orxout(internal_warning, context::quests) << e.getFullDescription() << endl;
    9999            return false;
    100100        }
    101101
    102         COUT(4) << "Quest {" << quest->getId() << "} failed by player: " << player << " ." << std::endl;
     102        orxout(verbose, context::quests) << "Quest {" << quest->getId() << "} failed by player: " << player << " ." << endl;
    103103        return true;
    104104    }
Note: See TracChangeset for help on using the changeset viewer.