by Mike Sandford for EuroPython 2012
The Python logging module is a useful tool for getting all kinds of information out of your program; everything from error notifications through to debug information. The standard facilities are useful out of the box, but, sometimes, you need a bit more. Not surprisingly, it turns out that the logging module is designed to be extended. This presentation shows some of the things you can do; things like gathering statistics on message type, directing emails to different recipients depending on severity, dynamic updating of attributes, and logging to a database.
The examples are based on the notification facilities in Lokai.
The talk covers:
an overview of why I thought I needed the extra features,
a look at the logger structures that need to be changed,
and some actual code that does the job.
I’m sure there are many different ways of doing this. Some of the code might be obvious in retrospect, and some might be surprising. Whatever the case, if you havn’t thought of doing this before you might be encouraged to give it a go. And if you have done it before you can always come and heckle.