Table Of Contents

Previous topic

Examples for rrlog

Next topic

More Features

This Page

Examples for rrlog

A Remote Rotating Log for Python that works instantly

Use Pythons standard logging

The log object (the callable thing we always used above) can be registered as a handler:

import logging

logger = logging.getLogger("Demo")

# standard logging calls should work now:
for i in xrange(7):"An info via standard logging #%s"%(i)) # omitted !
	logger.warn("A warning via standard logging #%s"%(i))


Now you can use the usual python logging calls.

Beautify Stacktraces

Logged stack traces look ugly with the python standard logging. The __init__ file of the standard logging package dominates somewhat. It can be hidden.

Shorten stack paths

What with the custom categories ?

A drawback of the standard logging module: We can’t use custom message categories (On the other hand, standard logging allows to register separate handlers.)

As a workaround, rrlog interprets the LEVELs of standard logging as category letters. For example, the call logging.error(...) automatically gets category “E”. The mapping of LEVEL<->category is in a LEVELMAP in :py:mod:`rrlog.logging23. You may customize that map.