logutils


Utilities for Python logging

THIS PROJECT HAS NOW BEEN MOVED.

The logutils package provides a set of handlers and utilities for the Python standard library's logging package.

Some of these handlers are out-of-scope for the standard library, and so they are packaged here. Others are updated versions which have appeared in recent Python releases, but are usable with older versions of Python, and so are packaged here.

What's included:

  • Helpers for working with queues (QueueHandler, QueueListener)
  • Helpers for working with unit tests (TestHandler, Matcher)
  • A NullHandler for use when configuring logging for libraries
  • An updated LoggerAdapter (used for adding contextual information to logs - more useful for subclassing than before)
  • An updated HTTPHandler (used to send information to Web sites - adds secure and credentials options)
  • Dictionary-based configuration as proposed in PEP 391 (and now in Python 2.7 and Python 3.2).
  • A stream handler which colorizes terminal streams on Windows, Linux and Mac OS X, as described here. All components other than LoggerAdapter should work with Python 2.4 or greater.

LoggerAdapter requires Python 2.5 or greater, as it's specifically designed to work with a feature in the underlying logging package which was introduced with 2.5. Some of the formatting features will only work on Python 2.6 or greater, as that is when str.format was added to Python. Named handlers, and hence incremental handler configuration, are only available on Python 2.X >= 2.7 and Python 3.X >= 3.2.

The source code repository for this project is at

https://bitbucket.org/vinay.sajip/logutils/


Changes

Version 0.3.3

  • Added encoding support to ColorizingStreamHandler.

Version 0.3.2

  • Made improvements in QueueListener implementation.
  • Added redis module with RedisQueueHandler and RedisQueueListener classes.
  • Added a unit test for a handler in a module where absolute imports are used.

Version 0.3.1

  • Improved setup.py and documentation.

Version 0.3

  • Added caches for BraceMessage/DollarMessage.
  • Added ColorizingStreamHandler.

Version 0.2

  • Updated docstrings for improved documentation.
  • Added hasHanders() function.
  • Changed LoggerAdapter.hasHandlers() to use logutils.hasHandlers().
  • Documentation improvements.
  • NullHandler moved to logutils package (from queue subpackage).
  • Formatter added to logutils package. Adds support for {}- and $-formatting in format strings, as well as %-formatting.
  • BraceMessage and DollarMessage classes added to facilitate {}- and $-formatting in logging calls (as opposed to Formatter formats).
  • Added some more unit tests.

Version 0.1

  • First public release.

Project Information