diff options
author | MaZderMind <github@mazdermind.de> | 2015-05-14 17:30:11 +0200 |
---|---|---|
committer | MaZderMind <github@mazdermind.de> | 2015-05-14 17:30:11 +0200 |
commit | fbd6d801ed08d560e050c48048e419be6fd35e3a (patch) | |
tree | 0f58d5cf531e8c138082d71da5c313d1e3b908bf /voctocore/voctocore.py | |
parent | 66d7b53682f87541dcd0970bd76bcb3b677977fb (diff) |
Improve/Repair Logging
Diffstat (limited to 'voctocore/voctocore.py')
-rwxr-xr-x | voctocore/voctocore.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/voctocore/voctocore.py b/voctocore/voctocore.py index 221291c..2f60f72 100755 --- a/voctocore/voctocore.py +++ b/voctocore/voctocore.py @@ -59,9 +59,19 @@ def main(): # configure logging docolor = (Args.color == 'always') or (Args.color == 'auto' and sys.stderr.isatty()) - logging.basicConfig( - level=logging.DEBUG if Args.verbose else logging.WARNING, - format='\x1b[33m%(levelname)8s\x1b[0m \x1b[32m%(name)s\x1b[0m: %(message)s' if docolor else '%(levelname)8s %(name)s: %(message)s') + if Args.verbose == 2: + level = logging.DEBUG + elif Args.verbose == 1: + level = logging.INFO + else: + level = logging.WARNING + + if docolor: + format = '\x1b[33m%(levelname)8s\x1b[0m \x1b[32m%(name)s\x1b[0m: %(message)s' + else: + format = '%(levelname)8s %(name)s: %(message)s' + + logging.basicConfig(level=level, format=format) # make killable by ctrl-c logging.debug('setting SIGINT handler') |