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/network/synchronisable/Synchronisable.cc

    r8706 r8858  
    130130//     assert( !header.isDiffed() );
    131131
    132     COUT(4) << "fabricating object with id: " << header.getObjectID() << std::endl;
     132    orxout(verbose, context::network) << "fabricating object with id: " << header.getObjectID() << endl;
    133133
    134134    Identifier* id = ClassByID(header.getClassID());
     
    136136    {
    137137        for(int i = 0; i<160; i++)
    138             COUT(0) << "classid: " << i << " identifier: " << ClassByID(i) << endl;
    139         COUT(0) << "Assertion failed: id" << std::endl;
    140         COUT(0) << "Possible reason for this error: Client received a synchronizable object whose class has no factory." << std::endl;
     138            orxout(user_error, context::network) << "classid: " << i << " identifier: " << ClassByID(i) << endl;
     139        orxout(user_error, context::network) << "Assertion failed: id" << endl;
     140        orxout(user_error, context::network) << "Possible reason for this error: Client received a synchronizable object whose class has no factory." << endl;
    141141        abort();
    142142    }
     
    168168      bo->setLevel(creator->getLevel());          // Note: this ensures that the level is known on the client for child objects of the scene (and the scene itself)
    169169    //assert(no->classID_ == header.getClassID());
    170     COUT(4) << "fabricate objectID_: " << no->objectID_ << " classID_: " << no->classID_ << std::endl;
     170    orxout(verbose, context::network) << "fabricate objectID_: " << no->objectID_ << " classID_: " << no->classID_ << endl;
    171171          // update data and create object/entity...
    172172    bool b = no->updateData(mem, mode, true);
     
    242242    uint8_t* oldmem = mem;
    243243    if (this->classID_==0)
    244       COUT(3) << "classid 0 " << this->getIdentifier()->getName() << std::endl;
     244      orxout(internal_info, context::network) << "classid 0 " << this->getIdentifier()->getName() << endl;
    245245#endif
    246246
     
    258258    // end copy header
    259259
    260     CCOUT(5) << "getting data from objectID_: " << objectID_ << ", classID_: " << classID_ << std::endl;
    261 //     COUT(4) << "objectid: " << this->objectID_ << ":";
     260    orxout(verbose_more, context::network) << "getting data from objectID_: " << objectID_ << ", classID_: " << classID_ << endl;
     261//     orxout(verbose, context::network) << "objectid: " << this->objectID_ << ":";
    262262    // copy to location
    263263    for(i=syncList_.begin(); i!=syncList_.end(); ++i)
    264264    {
    265265      uint32_t varsize = (*i)->getData( mem, mode );
    266 //       COUT(4) << " " << varsize;
     266//       orxout(verbose, context::network) << " " << varsize;
    267267      tempsize += varsize;
    268268      sizes.push_back(varsize);
     
    271271    }
    272272    assert(tempsize!=0);  // if this happens an empty object (with no variables) would be transmitted
    273 //     COUT(4) << endl;
     273//     orxout(verbose, context::network) << endl;
    274274
    275275    header.setObjectID( this->objectID_ );
     
    305305    if(syncList_.empty())
    306306    {
     307      orxout(internal_warning, context::network) << "Synchronisable::updateData syncList_ is empty" << endl;
    307308      assert(0);
    308       COUT(2) << "Synchronisable::updateData syncList_ is empty" << std::endl;
    309309      return false;
    310310    }
     
    326326    }
    327327
    328     //COUT(5) << "Synchronisable: objectID_ " << syncHeader.getObjectID() << ", classID_ " << syncHeader.getClassID() << " size: " << syncHeader.getDataSize() << " synchronising data" << std::endl;
     328    //orxout(verbose_more, context::network) << "Synchronisable: objectID_ " << syncHeader.getObjectID() << ", classID_ " << syncHeader.getClassID() << " size: " << syncHeader.getDataSize() << " synchronising data" << endl;
    329329    if( !syncHeaderLight.isDiffed() )
    330330    {
     
    344344    {
    345345      mem += SynchronisableHeaderLight::getSize();
    346 //       COUT(0) << "objectID: " << this->objectID_ << endl;
     346//       orxout(debug_output, context::network) << "objectID: " << this->objectID_ << endl;
    347347      while( mem < data+syncHeaderLight.getDataSize()+SynchronisableHeaderLight::getSize() )
    348348      {
    349349        VariableID varID = *(VariableID*)mem;
    350 //         COUT(0) << "varID: " << varID << endl;
     350//         orxout(debug_output, context::network) << "varID: " << varID << endl;
    351351        assert( varID < syncList_.size() );
    352352        mem += sizeof(VariableID);
Note: See TracChangeset for help on using the changeset viewer.