Some outside discussion on different log severities:
http://stackoverflow.com/questions/2031 ... log-levels
http://stackoverflow.com/questions/7839 ... log-levels
In particular, I like the thought of passing some threshold for each level, so I will list suggestion from least severity.
For final release, I currently would expect the default log level to be Info (for all channels/scopes).
- Trace From a developer view, this would be the default severity.
Detailed or high volume info. - Debug Limited to a single line and once per operation/function (some leeway could be given here).
Concisely summarized messages for general debugging. - Info Should always be displayed in a final release. Concise and not high volume .
Informational message. - Warn Unexpected result (from another operation) or other issue.
Recoverable error. Potentially a bug. - Error Issue within the current operation/function.
Unrecoverable error. Definite bug.
e.g. We might Warn that a string is being truncated, or where we use the result of functionA and that result was an unexpected value. functionA should issue an Error before returning such a value.
Fatal was excluded, as in #1481 it can likely be rolled into Error for the needs here.
Mostly in line with the comments within #1481. Difference being Info and lower:
Unsure if python needs some different rule or exception, if Trace can not be worked in. Possibly set the logger for std::out to trace?LGM-Doyle@#1481 wrote:The intended uses of the levels are:
error - used for "major" unrecoverable errors which will affect game play. Error level issues
need to be fixed. Error level will probably not be turned off unless they are flooding
the logs.
Examples are: the game is about to crash, a string is missing from the stringtable, etc.
warn - used for "minor", recoverable errors that will not affect game play but do indicate a
problem.
For example a missing id that can be ignored, an extra item in a container.
info - used to report normal game state and progress. This should be the default level of
logging. The number of log should be low enought to not floow the logs.
For example reporting that the network connected/disconnected.
debug - used for low-level implementation or calculation details. For a named logger this
level will probably only be turned on by devs working on that
section of code. This will be detailed and perhaps voluminous.
For example reporting that the network disconnected via a client initiated shutdown
with a linger time of 30 ms before closing.
trace - used for the highest detail of logging.
Morlic-fo@669 wrote:As far as log-levels are concerned, I think the following makes sense (for the AI at least):
Fatal / Error: Should exclusively used along with freeorion_tools.print_error to show the error in the chat window as well. Not sure which function should call which one.
Warning: Should be used for "minor" errors such as not getting a ship object from a (supposedly valid) ship_id.
Log(?): Any server update / message as well as orders issued by the AI client
Info: Anything that logs the current AI gamestate such as the table about colonization possibilities or threat assessment.
Debug: Strictly for debugging or logging implementation details. Explicitly not for printing high-level game-related info.