LoggingKit

Contents

What is it?

LoggingKit provides an flexible approach to include various kinds of log messages in your applications.

Where can I find it?

You can get the latest version of LoggingKit at: http://www.scourbase.com/LoggingKit/

How do I use it?

  1. Include log messages in your application. Example:

    from LoggingKit import Logger
    
    class LogTest:
        def __init__(self):
            self.logHandler = Logger.logHandler(self.__class__, 'TestCategory')
    
        def doSomething(self):
            self.logHandler.info('The weather seems to be fine')
            self.logHandler.trace('entered doSomething method')

There are methods for every possible LogLevel (INFO, TRACE, WARN, ERROR, FATAL).

  1. Capture those messages

LoggingKit uses the concept of <nop>LogListeners with respond to incoming log messages.

Say you want to save all messages which occur in the category 'TestCategory' and are in the LogLevel INFO into the file /var/log/TestCategoryInfo.log and discard all TRACE messages.

The following Logger.config will do it:

{'LogListener': [{'listenerName': 'InfoFile',
                  'listenerType': 'LoggingKit.FileListener#DirectToFileListener',
                  'listenerConfig': {'format': '%(date)s %(time)s - %(level)s - %(category)s    %(msg)s\n',
                  'destination': '/var/log/TestCategoryInfo.log',
                                    },
                  'filter': [{'type': 'category',
                              'criteria': ['TestCategory',]}]
                             {'type': 'level',
                              'criteria': ['INFO',]}]
                 },
                ]
}

-- SaschaMatzke - 16 Nov 2001

I realized that this package wasn't available a long time (I somehow f***ed up the URL). If anyone is still interested in this piece of software it can be found at: http://www.scourbase.com/LoggingKit/

-- SaschaMatzke - 03 Feb 2003 <br />