summaryrefslogtreecommitdiff
path: root/src/leap/bitmask
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r--src/leap/bitmask/app.py8
-rw-r--r--src/leap/bitmask/util/__init__.py5
-rw-r--r--src/leap/bitmask/util/leap_log_handler.py7
3 files changed, 10 insertions, 10 deletions
diff --git a/src/leap/bitmask/app.py b/src/leap/bitmask/app.py
index a702ab3a..1146d1d0 100644
--- a/src/leap/bitmask/app.py
+++ b/src/leap/bitmask/app.py
@@ -50,7 +50,7 @@ from PySide import QtCore, QtGui
from leap.bitmask import __version__ as VERSION
from leap.bitmask.util import leap_argparse
-from leap.bitmask.util import log_silencer
+from leap.bitmask.util import log_silencer, LOG_FORMAT
from leap.bitmask.util.leap_log_handler import LeapLogHandler
from leap.bitmask.util.streamtologger import StreamToLogger
from leap.bitmask.platform_init import IS_WIN
@@ -100,11 +100,7 @@ def add_logger_handlers(debug=False, logfile=None, replace_stdout=True):
# Create logger and formatter
logger = logging.getLogger(name='leap')
logger.setLevel(level)
-
- # levelname length == 8, since 'CRITICAL' is the longest
- log_format = ('%(asctime)s - %(levelname)-8s - '
- 'L#%(lineno)-4s : %(name)s:%(funcName)s() - %(message)s')
- formatter = logging.Formatter(log_format)
+ formatter = logging.Formatter(LOG_FORMAT)
# Console handler
try:
diff --git a/src/leap/bitmask/util/__init__.py b/src/leap/bitmask/util/__init__.py
index c35be99e..2b2cd874 100644
--- a/src/leap/bitmask/util/__init__.py
+++ b/src/leap/bitmask/util/__init__.py
@@ -28,6 +28,11 @@ from leap.common.config import get_path_prefix as common_get_path_prefix
# We'll give your money back if it does not alleviate the eye strain, at least.
+# levelname length == 8, since 'CRITICAL' is the longest
+LOG_FORMAT = ('%(asctime)s - %(levelname)-8s - '
+ 'L#%(lineno)-4s : %(name)s:%(funcName)s() - %(message)s')
+
+
def first(things):
"""
Return the head of a collection.
diff --git a/src/leap/bitmask/util/leap_log_handler.py b/src/leap/bitmask/util/leap_log_handler.py
index 1ab62331..807e53d4 100644
--- a/src/leap/bitmask/util/leap_log_handler.py
+++ b/src/leap/bitmask/util/leap_log_handler.py
@@ -21,6 +21,8 @@ import logging
from PySide import QtCore
+from leap.bitmask.util import LOG_FORMAT
+
class LogHandler(logging.Handler):
"""
@@ -52,10 +54,7 @@ class LogHandler(logging.Handler):
:param logging_level: the debug level to define the color.
:type logging_level: str.
"""
- log_format = ('%(asctime)s - %(name)s:%(funcName)s:L#%(lineno)s '
- '- %(levelname)s - %(message)s')
- formatter = logging.Formatter(log_format)
-
+ formatter = logging.Formatter(LOG_FORMAT)
return formatter
def emit(self, logRecord):