summaryrefslogtreecommitdiff
path: root/voctogui/voctogui.py
diff options
context:
space:
mode:
authorMaZderMind <git@mazdermind.de>2015-11-26 17:15:19 +0100
committerMaZderMind <git@mazdermind.de>2015-11-26 17:15:19 +0100
commit6c415915a5980ed8f750a6d73d243b2a4842adf2 (patch)
tree8a08f422270b0c5c86257461dc256ea30f6255b4 /voctogui/voctogui.py
parentd513ed2bb25250945daebb4804324cd5e6ad5048 (diff)
color warnings and errors differently, fixes #24
Diffstat (limited to 'voctogui/voctogui.py')
-rwxr-xr-xvoctogui/voctogui.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/voctogui/voctogui.py b/voctogui/voctogui.py
index 9f0cc0a..083b004 100755
--- a/voctogui/voctogui.py
+++ b/voctogui/voctogui.py
@@ -29,6 +29,7 @@ Gtk.init([])
from lib.args import Args
from lib.config import Config
from lib.ui import Ui
+from lib.loghandler import LogHandler
import lib.connection as Connection
@@ -85,6 +86,9 @@ def main():
# configure logging
docolor = (Args.color == 'always') or (Args.color == 'auto' and sys.stderr.isatty())
+ handler = LogHandler(docolor)
+ logging.root.addHandler(handler)
+
if Args.verbose >= 2:
level = logging.DEBUG
elif Args.verbose == 1:
@@ -92,12 +96,7 @@ def main():
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)
+ logging.root.setLevel(level)
# make killable by ctrl-c
logging.debug('setting SIGINT handler')