]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added log() function
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Fri, 24 Sep 2004 11:45:52 +0000 (11:45 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Fri, 24 Sep 2004 11:45:52 +0000 (11:45 +0000)
Lib/logging/__init__.py

index 08e6e471e3746570c22f4746c1d9bac650af3a91..987bc13722d3c1c804682c1b849f9fd7024dbabe 100644 (file)
@@ -1245,6 +1245,14 @@ def debug(msg, *args, **kwargs):
         basicConfig()
     apply(root.debug, (msg,)+args, kwargs)
 
+def log(level, msg, *args, **kwargs):
+    """
+    Log 'msg % args' with the integer severity 'level' on the root logger.
+    """
+    if len(root.handlers) == 0:
+        basicConfig()
+    apply(root.log, (level, msg)+args, kwargs)
+
 def disable(level):
     """
     Disable all logging calls less severe than 'level'.