changeset 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 ff46fa76e13f
children 412b50bb3740
files MoinMoin/server/__init__.py MoinMoin/support/logging_fix.py
diffstat 2 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/server/__init__.py	Wed Apr 04 01:04:54 2007 +0200
+++ b/MoinMoin/server/__init__.py	Thu Apr 05 12:37:50 2007 +0200
@@ -12,6 +12,7 @@
 import logging
 
 from MoinMoin import config
+from MoinMoin.support import logging_fix
 
 def switchUID(uid, gid):
     """ Switch identity to safe user and group
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/support/logging_fix.py	Thu Apr 05 12:37:50 2007 +0200
@@ -0,0 +1,15 @@
+# -*- 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