summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/app.py
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-10-28 13:03:54 -0300
committerTomás Touceda <chiiph@leap.se>2013-10-28 13:03:54 -0300
commit856a3301b025f3d14c36a0ec0c90563358780670 (patch)
tree8193836786a205b19359e696cb357af3d2ac3c29 /src/leap/bitmask/app.py
parente149f7e3e6a5c4621edd252fd7f75c580c5e49b3 (diff)
parent4c3329d67ec6730da0b26cc3b57a1ee689560cd0 (diff)
Merge remote-tracking branch 'kali/feature/refactor-mail-connections' into develop
Diffstat (limited to 'src/leap/bitmask/app.py')
-rw-r--r--src/leap/bitmask/app.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/leap/bitmask/app.py b/src/leap/bitmask/app.py
index 40a77075..3bb9c8c3 100644
--- a/src/leap/bitmask/app.py
+++ b/src/leap/bitmask/app.py
@@ -39,7 +39,6 @@
# M:::::::::::~NMMM7???7MMMM:::::::::::::::::::::::NMMMI??I7MMMM:::::::::::::M
# M::::::::::::::7MMMMMMM+:::::::::::::::::::::::::::?MMMMMMMZ:::::::::::::::M
# (thanks to: http://www.glassgiant.com/ascii/)
-
import logging
import signal
import sys
@@ -105,9 +104,16 @@ def add_logger_handlers(debug=False, logfile=None):
formatter = logging.Formatter(log_format)
# Console handler
- console = logging.StreamHandler()
- console.setLevel(level)
- console.setFormatter(formatter)
+ try:
+ import coloredlogs
+ console = coloredlogs.ColoredStreamHandler(level=level)
+ except ImportError:
+ console = logging.StreamHandler()
+ console.setLevel(level)
+ console.setFormatter(formatter)
+ using_coloredlog = False
+ else:
+ using_coloredlog = True
silencer = log_silencer.SelectiveSilencerFilter()
console.addFilter(silencer)
@@ -131,6 +137,9 @@ def add_logger_handlers(debug=False, logfile=None):
logger.addHandler(fileh)
logger.debug('File handler plugged!')
+ if not using_coloredlog:
+ replace_stdout_stderr_with_logging(logger)
+
return logger
@@ -185,7 +194,6 @@ def main():
BaseConfig.standalone = standalone
logger = add_logger_handlers(debug, logfile)
- replace_stdout_stderr_with_logging(logger)
# And then we import all the other stuff
from leap.bitmask.gui import locale_rc