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:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/Template.cc

    r7163 r8858  
    3232#include <tinyxml/ticpp.h>
    3333
    34 #include "util/Debug.h"
     34#include "util/Output.h"
    3535#include "CoreIncludes.h"
    3636#include "XMLPort.h"
     
    8888            it = Template::getTemplateMap().find(this->getName());
    8989            if (it != Template::getTemplateMap().end())
    90                 COUT(2) << "Warning: Template with name \"" << this->getName() << "\" already exists." << std::endl;
     90                orxout(internal_warning, context::templates) << "Template with name \"" << this->getName() << "\" already exists." << endl;
    9191            else
    9292                Template::getTemplateMap()[this->getName()] = this;
     
    117117                else
    118118                {
    119                     COUT(2) << "Warning: Linking from " << this->getName() << " to " << this->link_ << " leads to an infinite loop. Returning own element." << std::endl;
     119                    orxout(internal_warning, context::templates) << "Linking from \"" << this->getName() << "\" to \"" << this->link_ << "\" leads to an infinite loop. Returning own element." << endl;
    120120                }
    121121            }
    122122            else
    123123            {
    124                 COUT(2) << "Warning: " << this->link_ << " is not an existing Template name. Returning own element." << std::endl;
     124                orxout(internal_warning, context::templates) << '"' << this->link_ << "\" is not an existing Template name. Returning own element." << endl;
    125125            }
    126126        }
     
    142142            if (!object->isA(this->baseclassIdentifier_))
    143143            {
    144                 COUT(1) << "Error: Can't apply template (name: " << this->getName() << "), object (name: " << object->getName() << ", class: " << object->getIdentifier()->getName() << ") is not a " << this->baseclassIdentifier_->getName() << std::endl;
     144                orxout(internal_error, context::templates) << "Can't apply template (name: " << this->getName() << "), object (name: " << object->getName() << ", class: " << object->getIdentifier()->getName() << ") is not a " << this->baseclassIdentifier_->getName() << endl;
    145145                return;
    146146            }
    147147        }
    148148
    149         COUT(4) << object->getLoaderIndentation() << " aplying Template \"" << this->getName() << "\"..." << std::endl;
     149        orxout(verbose, context::templates) << object->getLoaderIndentation() << " aplying Template \"" << this->getName() << "\"..." << endl;
    150150
    151151        Element temp = &const_cast<TiXmlElement&>(this->getXMLElement());
     
    170170        else
    171171        {
    172             COUT(2) << "Warning: Template with name " << name << " doesn't exist." << std::endl;
     172            orxout(internal_warning, context::templates) << "Template with name " << name << " doesn't exist." << endl;
    173173            return 0;
    174174        }
Note: See TracChangeset for help on using the changeset viewer.