naparuba/shinken — Issue #102: Using logging directives and logging levels (log, info, debug)
Author: xkilian
Created: 2012-01-07 18:38:10+00:00
State: open

Logging facilities exist in the Shinken code to send back information to the user.

The logging facilities are currently used in the code, but there are some inconsistencies when dealing with debugging. There is also no use of logging levels available from the logging module.

=== Issues ===

Issue 1 : Convert all print statements in the code to logger.xxx calls

Issue 2 : Use logger. to modulate what ouput is sent to the user

Issue 3 : For debug or informational logger messages, determine if the output could impede the performance or stability of the system and leave the logger statement commented out. Especially in looping code blocks *1

=== Logging levels ===

Draft proposal:

logger.log :

General level : General user logging about the system states including error or critical messages

logger.info :
Informational level : Critical, error, general. + Warnings and process control information: Entering and leaving control blocks, processing output, any warnings. Any information that might be useful to a user encountering a problem, so that he knows where to look at and what the issue is.

logger.debug :
Debugging and developper feedback : All uncommented debug statements should provide feedback to power users or developpers in isolating and understanding runtime problems. Expected output when getting bug reports. For developers, this would be the level associated with problematic debugging statements that may cause runtime problems, these statements would be typically commented out and only uncommented when doing deep dive debugging. (ex. performance)

logger.debug statements that have a performance impact or are considered a risk, should have their ouput pre-pended with

=== Comments ===

I do not think using additional logging levels would bring any benefit. Keeping it simple at three levels.

I would suggest including this in the development guidelines of Shinken. (See wiki : How to contribute in the sidebar)

*1 Future direction thinking : The debug statements could be enabled/commented out by preprocessing directive that would figure out if the debug output is required based on the selected log level.