view MoinMoin/support/logging_fix.py @ 1945:c7c346cd0a32

logging.log for python 2.3
author Johannes Berg <johannes AT sipsolutions DOT net>
date Thu, 05 Apr 2007 12:37:50 +0200
parents
children cfdb0ffc2910
line wrap: on
line source
# -*- coding: utf-8 -*-
"""
Python 2.3's logging module has no .log, this provides it.
"""

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