Module: deluge
Branch: multiuser
Commit: eeed72a977e3798f30324a397436a6318e2f5ed1

Author: Pedro Algarvio <[email protected]>
Date:   Tue Dec  7 14:21:45 2010 +0000

Fix `tweak_logging_levels()`.

---

 deluge/log.py |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/deluge/log.py b/deluge/log.py
index 9ae0d17..86acf2a 100644
--- a/deluge/log.py
+++ b/deluge/log.py
@@ -39,8 +39,7 @@
 import os
 import logging
 import inspect
-import pkg_resources
-from deluge import common, component
+from deluge import common
 from twisted.internet import defer
 from twisted.python.log import PythonLoggingObserver
 
@@ -119,6 +118,7 @@ class Logging(LoggingLoggerClass):
 
 levels = {
     "info": logging.INFO,
+    "warn": logging.WARNING,
     "warning": logging.WARNING,
     "error": logging.ERROR,
     "none": logging.CRITICAL,
@@ -202,13 +202,15 @@ def tweak_logging_levels():
     log = logging.getLogger(__name__)
     log.warn("logging.conf found! tweaking logging levels from %s",
              logging_config_file)
-    for line in open(logging_config_file, 'r'):
+    for line in open(logging_config_file, 'r').readlines():
         if line.strip().startswith("#"):
             continue
         name, level = line.strip().split(':')
-        if level in levels:
-            log.warn("Setting logger \"%s\" to logging level \"%s\"", name, 
level)
-            logging.getLogger(name).setLevel(levels.get(level))
+        if level not in levels:
+            continue
+
+        log.warn("Setting logger \"%s\" to logging level \"%s\"", name, level)
+        setLoggerLevel(level, name)
 
 
 def setLoggerLevel(level, logger_name=None):

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to