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

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/interfaces/PickupCarrier.cc

    r8351 r8858  
    7575            if(it != this->pickups_.end() && temp == *it) // Infinite loop avoidance, in case the pickup wasn't removed from the carrier somewhere in the carrierDestroy() procedure.
    7676            {
    77                 COUT(2) << "Oops. In a PickupCarrier, while cleaning up, a Pickupable (&" << temp << ") didn't unregister itself as it should have." << std::endl;;
     77                orxout(internal_warning, context::pickups) << "Oops. In a PickupCarrier, while cleaning up, a Pickupable (&" << temp << ") didn't unregister itself as it should have." << endl;;
    7878                it++;
    7979            }
     
    158158    bool PickupCarrier::addPickup(Pickupable* pickup)
    159159    {
    160         COUT(4) << "Adding Pickupable (&" << pickup << ") to PickupCarrier (&" << this << ")" << std::endl;
     160        orxout(verbose, context::pickups) << "Adding Pickupable (&" << pickup << ") to PickupCarrier (&" << this << ")" << endl;
    161161        return this->pickups_.insert(pickup).second;
    162162    }
     
    172172    bool PickupCarrier::removePickup(Pickupable* pickup)
    173173    {
    174         COUT(4) << "Removing Pickupable (&" << pickup << ") from PickupCarrier (&" << this << ")" << std::endl;
     174        orxout(verbose, context::pickups) << "Removing Pickupable (&" << pickup << ") from PickupCarrier (&" << this << ")" << endl;
    175175        return this->pickups_.erase(pickup) == 1;
    176176    }
  • code/trunk/src/orxonox/interfaces/Pickupable.cc

    r8464 r8858  
    7171        if(this->pickupIdentifier_ != NULL)
    7272        {
    73             COUT(4) << "Pickupable (&" << this << ") destroyed." << std::endl;
     73            orxout(verbose, context::pickups) << "Pickupable (&" << this << ") destroyed." << endl;
    7474            this->pickupIdentifier_->destroy();
    7575        }
     
    107107            this->OrxonoxClass::destroy();
    108108        else
    109             COUT(2) << this->getIdentifier()->getName() << " may be unsafe. " << std::endl;
     109            orxout(internal_warning, context::pickups) << this->getIdentifier()->getName() << " may be unsafe. " << endl;
    110110    }
    111111
     
    126126            return false;
    127127
    128         COUT(4) << "Pickupable (&" << this << ") set to used " << used << "." << std::endl;
     128        orxout(verbose, context::pickups) << "Pickupable (&" << this << ") set to used " << used << "." << endl;
    129129
    130130        this->used_ = used;
     
    201201            return false;
    202202
    203         COUT(4) << "Target " << target->getName() << " added to Pickupable (" << this->getIdentifier()->getName() << ") (&" << this << ")." << std::endl;
     203        orxout(verbose, context::pickups) << "Target " << target->getName() << " added to Pickupable (" << this->getIdentifier()->getName() << ") (&" << this << ")." << endl;
    204204        this->targets_.push_back(target);
    205205        return true;
     
    221221        if(!this->setCarrier(carrier))
    222222        {
    223             COUT(3) << "A Pickupable (&" << this << ") was trying to be added to a PickupCarrier, but was already present." << std::endl;
     223            orxout(internal_warning, context::pickups) << "A Pickupable (&" << this << ") was trying to be added to a PickupCarrier, but was already present." << endl;
    224224            return false;
    225225        }
    226226
    227227        this->setPickedUp(true);
    228         COUT(4) << "Pickupable (&" << this << ") got picked up by a PickupCarrier (&" << carrier << ")." << std::endl;
     228        orxout(verbose, context::pickups) << "Pickupable (&" << this << ") got picked up by a PickupCarrier (&" << carrier << ")." << endl;
    229229        return true;
    230230    }
     
    245245        assert(this->getCarrier()); // The Carrier cannot be NULL at this point.
    246246        if(!this->getCarrier()->removePickup(this)) //TODO Shouldn't this be a little later?
    247             COUT(2) << "Pickupable (&" << this << ", " << this->getIdentifier()->getName() << ") is being dropped, but it was not present in the PickupCarriers list of pickups." << std::endl;
    248 
    249         COUT(4) << "Pickupable (&" << this << ") got dropped up by a PickupCarrier (&" << this->getCarrier() << ")." << std::endl;
     247            orxout(internal_warning, context::pickups) << "Pickupable (&" << this << ", " << this->getIdentifier()->getName() << ") is being dropped, but it was not present in the PickupCarriers list of pickups." << endl;
     248
     249        orxout(verbose, context::pickups) << "Pickupable (&" << this << ") got dropped up by a PickupCarrier (&" << this->getCarrier() << ")." << endl;
    250250        this->setUsed(false);
    251251        this->setPickedUp(false);
     
    276276            return false;
    277277
    278         COUT(4) << "Pickupable (&" << this << ") set to pickedUp " << pickedUp << "." << std::endl;
     278        orxout(verbose, context::pickups) << "Pickupable (&" << this << ") set to pickedUp " << pickedUp << "." << endl;
    279279
    280280        this->pickedUp_ = pickedUp;
     
    305305            return false;
    306306
    307         COUT(4) << "Pickupable (&" << this << ") changed Carrier (& " << carrier << ")." << std::endl;
     307        orxout(verbose, context::pickups) << "Pickupable (&" << this << ") changed Carrier (& " << carrier << ")." << endl;
    308308
    309309        if(carrier != NULL && tell)
     
    340340        Pickupable* pickup = dynamic_cast<Pickupable*>(item);
    341341
    342         COUT(4) << "Pickupable (&" << this << ") cloned. Clone is new Pickupable (&" << pickup << ")." << std::endl;
     342        orxout(verbose, context::pickups) << "Pickupable (&" << this << ") cloned. Clone is new Pickupable (&" << pickup << ")." << endl;
    343343        return pickup;
    344344    }
  • code/trunk/src/orxonox/interfaces/RadarViewable.cc

    r8738 r8858  
    8383//         else
    8484//         {
    85 //             CCOUT(2) << "Attempting to access the radar, but the radar is non existent." << std::endl;
     85//             orxout(internal_warning) << "Attempting to access the radar, but the radar is non existent." << endl;
    8686//         }
    8787//         this->radarObjectDescription_ = str;
     
    106106        if (!object)
    107107        {
    108             COUT(1) << "Assertion: Every RadarViewable has to be assigned a WorldEntity pointer!" << std::endl;
     108            orxout(user_error) << "Assertion: Every RadarViewable has to be assigned a WorldEntity pointer!" << endl;
    109109            assert(0);
    110110        }
Note: See TracChangeset for help on using the changeset viewer.