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

    r7163 r8858  
    6464                        if (!this->sectionname_.empty())
    6565                        {
    66                             COUT(2) << object->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not a valid classname." << std::endl;
     66                            orxout(internal_warning, context::xml) << object->getLoaderIndentation() << "'" << child->Value() << "' is not a valid classname." << endl;
    6767                        }
    6868                        else
     
    7474                    if (!identifier->isA(objectIdentifier_))
    7575                    {
    76                         COUT(2) << object->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not a '" << objectIdentifier_->getName() << "'." << std::endl;
     76                        orxout(internal_warning, context::xml) << object->getLoaderIndentation() << "'" << child->Value() << "' is not a '" << objectIdentifier_->getName() << "'." << endl;
    7777                        continue;
    7878                    }
    7979                    if (!identifier->isLoadable())
    8080                    {
    81                         COUT(2) << object->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not loadable." << std::endl;
     81                        orxout(internal_warning, context::xml) << object->getLoaderIndentation() << "'" << child->Value() << "' is not loadable." << endl;
    8282                        continue;
    8383                    }
     
    8787                    try
    8888                    {
    89                         COUT(4) << object->getLoaderIndentation() << "fabricating " << child->Value() << "..." << std::endl;
     89                        orxout(verbose, context::xml) << object->getLoaderIndentation() << "fabricating " << child->Value() << "..." << endl;
    9090
    9191                        BaseObject* newObject = identifier->fabricate(object);
     
    9595                        {
    9696                            newObject->XMLPort(*child, XMLPort::LoadObject);
    97                             COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ')' << std::endl;
     97                            orxout(verbose, context::xml) << object->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ')' << endl;
    9898                        }
    9999                        else
    100100                        {
    101                             COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (object not yet loaded) to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ')' << std::endl;
     101                            orxout(verbose, context::xml) << object->getLoaderIndentation() << "assigning " << child->Value() << " (object not yet loaded) to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ')' << endl;
    102102                        }
    103 
    104                         COUT(5) << object->getLoaderIndentation();
    105103
    106104                        this->callLoadExecutor(object, newObject);
     
    109107                            newObject->XMLPort(*child, XMLPort::LoadObject);
    110108
    111                         COUT(5) << object->getLoaderIndentation() << "...fabricated " << child->Value() << " (objectname " << newObject->getName() << ")." << std::endl;
     109                        orxout(verbose, context::xml) << object->getLoaderIndentation() << "fabricated " << child->Value() << " (objectname " << newObject->getName() << ")." << endl;
    112110                    }
    113111                    catch (AbortLoadingException& ex)
    114112                    {
    115                         COUT(1) << "An error occurred while loading object, abort loading..." << std::endl;
     113                        orxout(internal_error, context::xml) << "An error occurred while loading object, abort loading..." << endl;
    116114                        throw ex;
    117115                    }
    118116                    catch (...)
    119117                    {
    120                         COUT(1) << "An error occurred while loading object:" << std::endl;
    121                         COUT(1) << Exception::handleMessage() << std::endl;
     118                        orxout(internal_error, context::xml) << "An error occurred while loading object:" << endl;
     119                        orxout(internal_error, context::xml) << Exception::handleMessage() << endl;
    122120                    }
    123121                }
     
    125123            catch (ticpp::Exception& ex)
    126124            {
    127                 COUT(1) << std::endl;
    128                 COUT(1) << "An error occurred in XMLPort.h while loading a '" << objectIdentifier_->getName() << "' in '" << this->sectionname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << object->getName() << ") in " << object->getFilename() << ':' << std::endl;
    129                 COUT(1) << ex.what() << std::endl;
     125                orxout(internal_error, context::xml) << endl;
     126                orxout(internal_error, context::xml) << "An error occurred in XMLPort.h while loading a '" << objectIdentifier_->getName() << "' in '" << this->sectionname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << object->getName() << ") in " << object->getFilename() << ':' << endl;
     127                orxout(internal_error, context::xml) << ex.what() << endl;
    130128            }
    131129        }
Note: See TracChangeset for help on using the changeset viewer.