summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurie Clark-Michalek <bluepeppers@archlinux.us>2011-06-11 12:51:04 +0100
committerLaurie Clark-Michalek <bluepeppers@archlinux.us>2011-06-11 12:51:04 +0100
commitaff7528c635c73d888c6609fb6acf4a60444ff3b (patch)
treea16b4e590f3c914c5bc03101684b75ff564ee990
parenta33c879fdb2015756a448f695abbe5502e5a312e (diff)
Changed usage of the --debug option.
-rwxr-xr-xarchey318
1 files changed, 15 insertions, 3 deletions
diff --git a/archey3 b/archey3
index 801cd11..03a8ccb 100755
--- a/archey3
+++ b/archey3
@@ -21,7 +21,7 @@ import re
import os.path
try:
- from logbook import Logger
+ from logbook import Logger, lookup_level
except ImportError:
class Logger(object):
def __init__(self, name, level=0):
@@ -29,6 +29,9 @@ except ImportError:
self.level = level
debug = info = warn = warning = notice = error = exception = \
critical = log = lambda *a, **kw: None
+
+ def lookup_level(_):
+ return 0
UNAME_FLAG_MEANINGS = {
'a': 'System Infomation',
@@ -551,7 +554,7 @@ class Archey(object):
def __init__(self, config, options):
self.config = config
- self.log_level = int(options.log_level)
+ self.log_level = lookup_level(options.log_level)
self.logger = Logger("Core", self.log_level)
self.display = config.get("core", "display_modules")
@@ -714,7 +717,16 @@ def main():
action='store', dest='config', default=None,
help="Set the location of the config file to load.")
parser.add_option('--debug',
- action='store', dest='log_level', default=1)
+ action='store', type='choice', dest='log_level',
+ choices=('NOTSET',
+ 'DEBUG',
+ 'INFO',
+ 'WARNING',
+ 'ERROR',
+ 'CRITICAL'),
+ default='CRITICAL',
+ help="The level of errors you wish to display. Choices are\
+ NOTSET, DEBUG, INFO, WARNING, ERROR, and CRITICAL. CRITICAL is the default.")
(options, args) = parser.parse_args()
config = ArcheyConfigParser()