view MoinMoin/support/logging_fix.py @ 1949:cfdb0ffc2910

move logging_fix import to MoinMoin.config, fix encoding/docstring
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 06 Apr 2007 13:08:19 +0200
parents c7c346cd0a32
children b077f4b271c9
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():
            apply(logging.root._log, (level, msg, args), kwargs)
    logging.log = log