diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2004-09-24 11:45:52 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2004-09-24 11:45:52 (GMT) |
commit | b2635b2f7163716d735e7eda7c1d5c039410d3e4 (patch) | |
tree | 804ce8ac40727fbb8ba426defffdc397345b5036 /Lib/logging | |
parent | 02dd994adf7de5ea6521b0f405b80d78c7081fee (diff) | |
download | cpython-b2635b2f7163716d735e7eda7c1d5c039410d3e4.zip cpython-b2635b2f7163716d735e7eda7c1d5c039410d3e4.tar.gz cpython-b2635b2f7163716d735e7eda7c1d5c039410d3e4.tar.bz2 |
Added log() function
Diffstat (limited to 'Lib/logging')
-rw-r--r-- | Lib/logging/__init__.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 08e6e47..987bc13 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -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'. |