diff options
author | Kali Kaneko <kali@leap.se> | 2013-09-12 14:29:32 +0200 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2013-09-12 14:29:32 +0200 |
commit | b1a2ec9a672d6f097d56d039d164918508f72ceb (patch) | |
tree | 0e259ada6c41b5e660f2e64188238acf4594f140 /src/leap/bitmask/app.py | |
parent | 4951157e3740b42ecef6775c8927b912a6ee8870 (diff) | |
parent | 9568093138c85212e15d50ade5d5fc7dcec9ff6e (diff) |
Merge branch 'master' into debian
Conflicts:
pkg/requirements.pip
setup.py
Diffstat (limited to 'src/leap/bitmask/app.py')
-rw-r--r-- | src/leap/bitmask/app.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/leap/bitmask/app.py b/src/leap/bitmask/app.py index 6ffa1d25..158f1afe 100644 --- a/src/leap/bitmask/app.py +++ b/src/leap/bitmask/app.py @@ -25,6 +25,7 @@ from functools import partial from PySide import QtCore, QtGui from leap.bitmask.util import leap_argparse +from leap.bitmask.util import log_silencer from leap.bitmask.util.leap_log_handler import LeapLogHandler from leap.bitmask.util.streamtologger import StreamToLogger from leap.common.events import server as event_server @@ -51,7 +52,7 @@ def install_qtreactor(logger): logger.debug("Qt4 reactor installed") -def add_logger_handlers(debug=False, logfile=None): +def add_logger_handlers(debug=False, logfile=None, standalone=False): """ Create the logger and attach the handlers. @@ -71,6 +72,7 @@ def add_logger_handlers(debug=False, logfile=None): # Create logger and formatter logger = logging.getLogger(name='leap') logger.setLevel(level) + log_format = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' formatter = logging.Formatter(log_format) @@ -78,12 +80,16 @@ def add_logger_handlers(debug=False, logfile=None): console = logging.StreamHandler() console.setLevel(level) console.setFormatter(formatter) + + silencer = log_silencer.SelectiveSilencerFilter(standalone=standalone) + console.addFilter(silencer) logger.addHandler(console) logger.debug('Console handler plugged!') # LEAP custom handler leap_handler = LeapLogHandler() leap_handler.setLevel(level) + leap_handler.addFilter(silencer) logger.addHandler(leap_handler) logger.debug('Leap handler plugged!') @@ -93,6 +99,7 @@ def add_logger_handlers(debug=False, logfile=None): fileh = logging.FileHandler(logfile) fileh.setLevel(logging.DEBUG) fileh.setFormatter(formatter) + fileh.addFilter(silencer) logger.addHandler(fileh) logger.debug('File handler plugged!') @@ -149,13 +156,13 @@ def main(): from leap.bitmask.gui.mainwindow import MainWindow from leap.bitmask.platform_init import IS_MAC from leap.bitmask.platform_init.locks import we_are_the_one_and_only - from leap.bitmask.util import __version__ as VERSION + from leap.bitmask import __version__ as VERSION from leap.bitmask.util.requirement_checker import check_requirements # pylint: avoid unused import assert(locale_rc) - logger = add_logger_handlers(debug, logfile) + logger = add_logger_handlers(debug, logfile, standalone) replace_stdout_stderr_with_logging(logger) if not we_are_the_one_and_only(): |