Skip to content
Enno Rehling edited this page Jun 3, 2014 · 1 revision

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.

Error Levels

The logging functions are all in until/log.h and the minimum level of logging can be controlled by eressea.ini

assert

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.

log_error

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.

log_warning

Warnings are for a non-corrupting problem. A user string that is too big to fit into a buffer, but gets truncated, for example.

log_debug

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.

log_info

Use this for printf style debugging information, it usually gets turned off in production.