Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 23, 2011, 12:45:53 AM (14 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/ConfigFileManager.cc

    r7401 r8858  
    123123        for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
    124124            if ((*it)->getName() == name)
    125                 if ((*it)->getIndex() > size)
    126                     size = (*it)->getIndex();
    127         if (size == 0)
    128             return 0;
    129         else
    130             return (size + 1);
     125                if ((*it)->getIndex() >= size)
     126                    size = (*it)->getIndex() + 1;
     127        return size;
    131128    }
    132129
     
    274271                        {
    275272                            boost::filesystem::copy_file(defaultFilepath, filepath);
    276                             COUT(3) << "Copied " << this->filename_ << " from the default config folder." << std::endl;
     273                            orxout(internal_info, context::config) << "Copied " << this->filename_ << " from the default config folder." << endl;
    277274                        }
    278275                        catch (const boost::filesystem::filesystem_error& ex)
    279                         { COUT(1) << "Error in ConfigFile: " << ex.what() << std::endl; }
     276                        { orxout(user_error, context::config) << "Error in ConfigFile: " << ex.what() << endl; }
    280277                    }
    281278                }
     
    375372            file.close();
    376373
    377             COUT(3) << "Loaded config file \"" << this->filename_ << "\"." << std::endl;
     374            orxout(internal_info, context::config) << "Loaded config file \"" << this->filename_ << "\"." << endl;
    378375
    379376            // DO NOT save the file --> we can open supposedly read only config files
     
    404401        if (!file.is_open())
    405402        {
    406             COUT(1) << "Error: Couldn't open config-file \"" << filename << "\"." << std::endl;
     403            orxout(user_error, context::config) << "Couldn't open config-file \"" << filename << "\"." << endl;
    407404            return;
    408405        }
     
    410407        for (std::list<ConfigFileSection*>::const_iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
    411408        {
    412             file << (*it)->getFileEntry() << std::endl;
     409            file << (*it)->getFileEntry() << endl;
    413410
    414411            for (std::list<ConfigFileEntry*>::const_iterator it_entries = (*it)->getEntriesBegin(); it_entries != (*it)->getEntriesEnd(); ++it_entries)
    415                 file << (*it_entries)->getFileEntry() << std::endl;
    416 
    417             file << std::endl;
     412                file << (*it_entries)->getFileEntry() << endl;
     413
     414            file << endl;
    418415        }
    419416
    420417        file.close();
    421418
    422         COUT(4) << "Saved config file \"" << filename << "\"." << std::endl;
     419        orxout(verbose, context::config) << "Saved config file \"" << filename << "\"." << endl;
    423420    }
    424421
     
    669666    {
    670667        if (!this->configImpl(section, entry, value, &ConfigValueContainer::set))
    671             COUT(1) << "Error: Config value \"" << entry << "\" in section \"" << section << "\" doesn't exist." << std::endl;
     668            orxout(user_error, context::config) << "Config value \"" << entry << "\" in section \"" << section << "\" doesn't exist." << endl;
    672669    }
    673670
     
    682679    {
    683680        if (!this->configImpl(section, entry, value, &ConfigValueContainer::tset))
    684             COUT(1) << "Error: Config value \"" << entry << "\" in section \"" << section << "\" doesn't exist." << std::endl;
     681            orxout(user_error, context::config) << "Config value \"" << entry << "\" in section \"" << section << "\" doesn't exist." << endl;
    685682    }
    686683
Note: See TracChangeset for help on using the changeset viewer.