summaryrefslogtreecommitdiffstats
path: root/deluge/log.py
diff options
context:
space:
mode:
authorAndrew Resch <andrewresch@gmail.com>2008-11-28 23:28:06 +0000
committerAndrew Resch <andrewresch@gmail.com>2008-11-28 23:28:06 +0000
commit1440d6b24702a881cab07235e93d1b2f1457aa07 (patch)
tree94c605bb43bbf8b4867394b81dd718d729f276db /deluge/log.py
parente759d61266b6bc9d0bb9eabd9e6e9cb8260df35b (diff)
downloaddeluge-1440d6b24702a881cab07235e93d1b2f1457aa07.tar.gz
deluge-1440d6b24702a881cab07235e93d1b2f1457aa07.tar.bz2
deluge-1440d6b24702a881cab07235e93d1b2f1457aa07.zip
Fix #531 set default log level to ERROR and add 2 command-line options,
"-L, --loglevel" and "-q, --quiet".
Diffstat (limited to 'deluge/log.py')
-rw-r--r--deluge/log.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/deluge/log.py b/deluge/log.py
index 1076cf81e..2f415158c 100644
--- a/deluge/log.py
+++ b/deluge/log.py
@@ -29,10 +29,31 @@ import logging
# Setup the logger
logging.basicConfig(
- level=logging.DEBUG,
+ level=logging.ERROR,
format="[%(levelname)-8s] %(asctime)s %(module)s:%(lineno)d %(message)s",
datefmt="%H:%M:%S"
)
+def setLoggerLevel(level):
+ """
+ Sets the logger level.
+
+ :param level: str, a string representing the desired level
+
+ """
+ levels = {
+ "info": logging.INFO,
+ "warning": logging.WARNING,
+ "error": logging.ERROR,
+ "none": logging.CRITICAL,
+ "debug": logging.DEBUG
+ }
+
+ if level not in levels:
+ return
+
+ global LOG
+ LOG.setLevel(levels[level])
+
# Get the logger
LOG = logging.getLogger("deluge")