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

    r7401 r8858  
    8585        }
    8686        catch (Tcl::tcl_error const &e)
    87         {   COUT(1) << "Tcl (IRC) error: " << e.what();   }
     87        {   orxout(user_error, context::tcl) << "Tcl (IRC) error: " << e.what() << endl;   }
    8888
    8989        this->nickname_ = "orx" + multi_cast<std::string>(static_cast<unsigned int>(rand()));
     
    100100        {
    101101            IRC::getInstance().initialize();
    102             COUT(1) << "Error: IRC client wasn't yet initialized, please try again." << std::endl;
     102            orxout(user_error) << "IRC client wasn't yet initialized, please try again." << endl;
    103103            return false;
    104104        }
     
    110110        }
    111111        catch (Tcl::tcl_error const &e)
    112         {   COUT(1) << "Tcl (IRC) error: " << e.what();   }
     112        {   orxout(user_error, context::tcl) << "Tcl (IRC) error: " << e.what() << endl;   }
    113113
    114114        return false;
     
    139139    void IRC::tcl_say(Tcl::object const &channel, Tcl::object const &nick, Tcl::object const &args)
    140140    {
    141         COUT(0) << "IRC> " << nick.get() << ": " << stripEnclosingBraces(args.get()) << std::endl;
     141        orxout(message) << "IRC> " << nick.get() << ": " << stripEnclosingBraces(args.get()) << endl;
    142142    }
    143143
     
    145145    void IRC::tcl_privmsg(Tcl::object const &query, Tcl::object const &nick, Tcl::object const &args)
    146146    {
    147         COUT(0) << "IRC (" << query.get() << ")> " << nick.get() << ": " << stripEnclosingBraces(args.get()) << std::endl;
     147        orxout(message) << "IRC (" << query.get() << ")> " << nick.get() << ": " << stripEnclosingBraces(args.get()) << endl;
    148148    }
    149149
     
    151151    void IRC::tcl_action(Tcl::object const &channel, Tcl::object const &nick, Tcl::object const &args)
    152152    {
    153         COUT(0) << "IRC> * " << nick.get() << ' ' << stripEnclosingBraces(args.get()) << std::endl;
     153        orxout(message) << "IRC> * " << nick.get() << ' ' << stripEnclosingBraces(args.get()) << endl;
    154154    }
    155155
     
    157157    void IRC::tcl_info(Tcl::object const &channel, Tcl::object const &args)
    158158    {
    159         COUT(0) << "IRC> --> " << stripEnclosingBraces(args.get()) << std::endl;
     159        orxout(message) << "IRC> --> " << stripEnclosingBraces(args.get()) << endl;
    160160    }
    161161}
Note: See TracChangeset for help on using the changeset viewer.