view MoinMoin/support/logging_fix.py @ 2937:3fcf13189a45

split Clock into an extra util package
author Johannes Berg <johannes AT sipsolutions DOT net>
date Tue, 30 Oct 2007 22:16:29 +0100
parents b077f4b271c9
children
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
"""
    Python 2.3's logging module has no .log, this provides it.

    @copyright: 2007 MoinMoin:JohannesBerg 
    @license: GNU GPL, see COPYING for details.
"""

import logging
if not hasattr(logging, 'log'):
    def log(level, msg, *args, **kwargs):
        if len(logging.root.handlers) == 0:
            logging.basicConfig()
        if logging.root.manager.disable >= level:
            return
        if level >= logging.root.getEffectiveLevel():
            logging.root._log(level, msg, args, **kwargs)
    logging.log = log