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/Identifier.cc

    r8267 r8858  
    130130        {
    131131            // If no: We have to store the information and initialize the Identifier
    132             COUT(4) << "*** ClassIdentifier: Register Class in " << this->getName() << "-Singleton -> Initialize Singleton." << std::endl;
     132            orxout(verbose, context::identifier) << "Register Class in ClassIdentifier<" << this->getName() << ">-Singleton -> Initialize Singleton." << endl;
    133133            if (bRootClass)
    134134                this->initialize(0); // If a class is derived from two interfaces, the second interface might think it's derived from the first because of the order of constructor-calls. Thats why we set parents to zero in that case.
     
    144144    void Identifier::initialize(std::set<const Identifier*>* parents)
    145145    {
    146         COUT(4) << "*** Identifier: Initialize " << this->name_ << "-Singleton." << std::endl;
     146        orxout(verbose, context::identifier) << "Initialize ClassIdentifier<" << this->name_ << ">-Singleton." << endl;
    147147        this->bCreatedOneObject_ = true;
    148148
     
    191191    void Identifier::createClassHierarchy()
    192192    {
    193         COUT(3) << "*** Identifier: Create class-hierarchy" << std::endl;
     193        orxout(internal_status) << "Create class-hierarchy" << endl;
    194194        Identifier::startCreatingHierarchy();
    195195        for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getStringIdentifierMap().begin(); it != Identifier::getStringIdentifierMap().end(); ++it)
     
    203203        }
    204204        Identifier::stopCreatingHierarchy();
    205         COUT(3) << "*** Identifier: Finished class-hierarchy creation" << std::endl;
     205        orxout(internal_status) << "Finished class-hierarchy creation" << endl;
    206206    }
    207207
     
    242242        else
    243243        {
    244             COUT(1) << "An error occurred in Identifier.cc:" << std::endl;
    245             COUT(1) << "Error: Cannot fabricate an object of type '" << this->name_ << "'. Class has no factory." << std::endl;
    246             COUT(1) << "Aborting..." << std::endl;
     244            orxout(user_error) << "An error occurred in Identifier.cc:" << endl;
     245            orxout(user_error) << "Cannot fabricate an object of type '" << this->name_ << "'. Class has no factory." << endl;
     246            orxout(user_error) << "Aborting..." << endl;
    247247            abort();
    248248            return 0;
     
    404404        if (it != this->configValues_.end())
    405405        {
    406             COUT(2) << "Warning: Overwriting config-value with name " << varname << " in class " << this->getName() << '.' << std::endl;
     406            orxout(internal_warning) << "Overwriting config-value with name " << varname << " in class " << this->getName() << '.' << endl;
    407407            delete (it->second);
    408408        }
     
    450450        if (it != this->xmlportParamContainers_.end())
    451451        {
    452             COUT(2) << "Warning: Overwriting XMLPortParamContainer in class " << this->getName() << '.' << std::endl;
     452            orxout(internal_warning) << "Overwriting XMLPortParamContainer in class " << this->getName() << '.' << endl;
    453453            delete (it->second);
    454454        }
     
    481481        if (it != this->xmlportObjectContainers_.end())
    482482        {
    483             COUT(2) << "Warning: Overwriting XMLPortObjectContainer in class " << this->getName() << '.' << std::endl;
     483            orxout(internal_warning) << "Overwriting XMLPortObjectContainer in class " << this->getName() << '.' << endl;
    484484            delete (it->second);
    485485        }
Note: See TracChangeset for help on using the changeset viewer.