diff options
author | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2010-10-20 18:30:25 +0200 |
---|---|---|
committer | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2010-10-20 18:30:25 +0200 |
commit | ee67b24ad9baaf38ef03c8e6cd6d5351e5d8e1cd (patch) | |
tree | ac447a790467fb14c9ae7c6b27516e79dd54b5ad | |
parent | be43daa69c2c4ac00dcc3d13172427493792f289 (diff) | |
download | logilab-common-ee67b24ad9baaf38ef03c8e6cd6d5351e5d8e1cd.tar.gz |
clcommands: fix log level bug: logthreshold may be given a string
-rw-r--r-- | clcommands.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clcommands.py b/clcommands.py index 1f08c0e..19a6c07 100644 --- a/clcommands.py +++ b/clcommands.py @@ -29,6 +29,7 @@ import logging from os.path import basename from logilab.common.configuration import Configuration +from logilab.common.logging_ext import init_log, get_threshold from logilab.common.deprecation import deprecated @@ -99,10 +100,9 @@ class CommandLine(dict): Terminate by :exc:`SystemExit` """ - from logilab.common import logging_ext - logging_ext.init_log(debug=True, # so that we use StreamHandler - logthreshold=self.logthreshold, - logformat='%(levelname)s: %(message)s') + init_log(debug=True, # so that we use StreamHandler + logthreshold=self.logthreshold, + logformat='%(levelname)s: %(message)s') try: arg = args.pop(0) except IndexError: @@ -139,7 +139,7 @@ class CommandLine(dict): logger = logging.Logger(self.pgm) logger.handlers = [handler] if logthreshold is None: - logthreshold = self.logthreshold + logthreshold = get_threshold(self.logthreshold) logger.setLevel(logthreshold) return logger @@ -148,7 +148,7 @@ class CommandLine(dict): logger = self.logger if logger is None: logger = self.logger = logging.getLogger(self.pgm) - logger.setLevel(self.logthreshold) + logger.setLevel(get_threshold(self.logthreshold)) return self[cmd](logger) def usage(self): |