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/command/ConsoleCommand.cc

    r8316 r8858  
    172172                if (!this->executor_->defaultValueSet(i))
    173173                {
    174                     COUT(2) << "Default value " << i << " is missing" << std::endl;
     174                    orxout(internal_warning, context::commands) << "Default value " << i << " is missing" << endl;
    175175                    return false;
    176176                }
     
    202202                if (!executor->defaultValueSet(i))
    203203                {
    204                     COUT(2) << "Default value " << i << " is missing" << std::endl;
     204                    orxout(internal_warning, context::commands) << "Default value " << i << " is missing" << endl;
    205205                    return false;
    206206                }
     
    229229        else
    230230        {
    231             COUT(1) << "Error: Couldn't assign new executor to console command \"" << this->baseName_ << "\", headers don't match." << std::endl;
     231            orxout(internal_error, context::commands) << "Couldn't assign new executor to console command \"" << this->baseName_ << "\", headers don't match." << endl;
    232232            return false;
    233233        }
     
    256256        else
    257257        {
    258             COUT(1) << "Error: Couldn't assign new functor to console command \"" << this->baseName_ << "\", headers don't match." << std::endl;
     258            orxout(internal_error, context::commands) << "Couldn't assign new functor to console command \"" << this->baseName_ << "\", headers don't match." << endl;
    259259            return false;
    260260        }
     
    307307            this->pushFunction(new Executor(*this->executor_.get()));
    308308        else
    309             COUT(1) << "Error: Couldn't push copy of executor in console command \"" << this->baseName_ << "\", no executor set." << std::endl;
     309            orxout(internal_error, context::commands) << "Couldn't push copy of executor in console command \"" << this->baseName_ << "\", no executor set." << endl;
    310310    }
    311311
     
    367367            }
    368368            else if (object)
    369                 COUT(1) << "Error: Can't assign object to console command \"" << this->baseName_ << "\", no functor set." << std::endl;
     369                orxout(internal_error, context::commands) << "Can't assign object to console command \"" << this->baseName_ << "\", no functor set." << endl;
    370370        }
    371371        else if (object)
    372             COUT(1) << "Error: Can't assign object to console command \"" << this->baseName_ << "\", no executor set." << std::endl;
     372            orxout(internal_error, context::commands) << "Can't assign object to console command \"" << this->baseName_ << "\", no executor set." << endl;
    373373
    374374        return false;
     
    418418            this->executor_->setDefaultValues(arg1);
    419419        else
    420             COUT(1) << "Error: Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << std::endl;
     420            orxout(internal_error, context::commands) << "Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << endl;
    421421
    422422        return *this;
     
    431431            this->executor_->setDefaultValues(arg1, arg2);
    432432        else
    433             COUT(1) << "Error: Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << std::endl;
     433            orxout(internal_error, context::commands) << "Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << endl;
    434434
    435435        return *this;
     
    444444            this->executor_->setDefaultValues(arg1, arg2, arg3);
    445445        else
    446             COUT(1) << "Error: Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << std::endl;
     446            orxout(internal_error, context::commands) << "Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << endl;
    447447
    448448        return *this;
     
    457457            this->executor_->setDefaultValues(arg1, arg2, arg3, arg4);
    458458        else
    459             COUT(1) << "Error: Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << std::endl;
     459            orxout(internal_error, context::commands) << "Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << endl;
    460460
    461461        return *this;
     
    470470            this->executor_->setDefaultValues(arg1, arg2, arg3, arg4, arg5);
    471471        else
    472             COUT(1) << "Error: Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << std::endl;
     472            orxout(internal_error, context::commands) << "Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << endl;
    473473
    474474        return *this;
     
    485485            this->executor_->setDefaultValue(index, arg);
    486486        else
    487             COUT(1) << "Error: Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << std::endl;
     487            orxout(internal_error, context::commands) << "Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << endl;
    488488
    489489        return *this;
     
    500500            this->argumentCompleter_[index] = completer;
    501501        else
    502             COUT(2) << "Warning: Couldn't add autocompletion-function for index " << index << " in console command \"" << this->baseName_ << "\": index out of bound." << std::endl;
     502            orxout(internal_warning, context::commands) << "Couldn't add autocompletion-function for index " << index << " in console command \"" << this->baseName_ << "\": index out of bound." << endl;
    503503
    504504        return *this;
     
    611611        {
    612612            if (group == "")
    613                 COUT(1) << "Error: Couldn't find console command with shortcut \"" << name << "\"" << std::endl;
     613                orxout(internal_error, context::commands) << "Couldn't find console command with shortcut \"" << name << "\"" << endl;
    614614            else
    615                 COUT(1) << "Error: Couldn't find console command with group \"" << group << "\" and name \"" << name << "\"" << std::endl;
     615                orxout(internal_error, context::commands) << "Couldn't find console command with group \"" << group << "\" and name \"" << name << "\"" << endl;
    616616        }
    617617        return 0;
     
    644644        {
    645645            if (group == "")
    646                 COUT(1) << "Error: Couldn't find console command with shortcut \"" << name << "\"" << std::endl;
     646                orxout(internal_error, context::commands) << "Couldn't find console command with shortcut \"" << name << "\"" << endl;
    647647            else
    648                 COUT(1) << "Error: Couldn't find console command with group \"" << group << "\" and name \"" << name << "\"" << std::endl;
     648                orxout(internal_error, context::commands) << "Couldn't find console command with group \"" << group << "\" and name \"" << name << "\"" << endl;
    649649        }
    650650        return 0;
     
    681681        {
    682682            if (group == "")
    683                 COUT(2) << "Warning: A console command with shortcut \"" << name << "\" already exists." << std::endl;
     683                orxout(internal_warning, context::commands) << "A console command with shortcut \"" << name << "\" already exists." << endl;
    684684            else
    685                 COUT(2) << "Warning: A console command with name \"" << name << "\" already exists in group \"" << group << "\"." << std::endl;
     685                orxout(internal_warning, context::commands) << "A console command with name \"" << name << "\" already exists in group \"" << group << "\"." << endl;
    686686        }
    687687        else
Note: See TracChangeset for help on using the changeset viewer.