-
Notifications
You must be signed in to change notification settings - Fork 23
Logging and Errors
I've been making some changes to what gets written into the logs this weekend. A normal run of Eressea used to write several messages with an ERROR log level every week, and I want to reserve that level for actual problems that might mean that the turn is invalid, and stop the sending of reports if they are in the log. So I've cleaned up the levels, fixed some of the complaints, and the turn now runs through pretty cleanly.
The logging functions are all in until/log.h and the minimum level of logging can be controlled by eressea.ini
Use an assert when there is a programming error. The turn will be aborted, but at least we don't corrupt any data or send a bad report. All assert calls are enabled in production, Eressea does not use a release build. To do: we should have a log_assert function instead.
Calling this means there is inconsistent data, either in the data file or the config files. We continue the turn, unless the call is followed by an assert or abort, but the reports will not be sent. An alert goes to the operator (me) instead.
Warnings are for a non-corrupting problem. A user string that is too big to fit into a buffer, but gets truncated, for example.
The debug level is for errors caused by user input. Bad syntax, any error message in their report, etc. Very bad problems like bad passwords could be at level warning, for more visibility. These are enabled in production, and can help us deal with some bug reports without having to rerun the turn in a debugger.
Use this for printf style debugging information, it usually gets turned off in production.
Eressea Fantasy Strategy PBEM Game
- Visit our Website
- Like us on Facebook
- Follow us on Twitter @eresseadev
- Become a Patron on Patreon
- Thank the GM on Flattr