If you can read this, you have JavaScript turned off.
Please turn it on for optimal browsing experience.
This is the code that was used originally in Umbra for error reporting. It relies on libtcod, but since the only libtcod-specific part of the code is the container storing the error messages, it can easily be converted to something else, for instance std::vector.
Everything in the header file is commented on using javadoc syntax - if you code using NetBeans or other IDE that supports javadoc, you can benefit from the live documentation. Here's a short version of what UmbraError offers:
//append a new error to the log
static int add (UmbraErrorLevel errLev, const char * errStr, ...);
static int add (UmbraErrorLevel errLev, std::string errStr);
//check if a file exists (same as TCODSystem::fileExists)
static bool fileExists (const char * filename, ...);
//retrieve last logged message
static const char * getLastMessage ();
//retrieve any message (you must know the index)
static const char * getMessage (int idx);
//check the total amount of errors logged so far
static int getNbErrors ();
You can append a new error to the error stack at any point in your code:
UmbraError::add(UMBRA_ERRORLEVEL_ERROR,"Something bad has just happened!");
and after you leave your application, you'll find an error log in your execution directory, saved as a human-readable .txt file, ready for analysis!
| Resource | File size |
| 4.45 kB |