summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/logs
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2015-10-06 12:43:13 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2015-10-06 15:54:59 -0300
commita1d6d06ec05ad3e2fb8f8b43fb693d2e1b4c75be (patch)
treefeb5280cf99493842d4163cc22e17766066c004a /src/leap/bitmask/logs
parent5518564ef8e054dbf15cd022ca01ccc656c89e5b (diff)
[bug] store logs in the right place
Load flags before creating logger so the logs path considers the standalone flag. Move the log file path definition to the function, otherwise it will calculated during import and (most likely) before defining the flags.STANDALONE value. Create logger inside `run_frontend` right after knowing if we are standalone or not. - Resolves: #7512
Diffstat (limited to 'src/leap/bitmask/logs')
-rw-r--r--src/leap/bitmask/logs/utils.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/leap/bitmask/logs/utils.py b/src/leap/bitmask/logs/utils.py
index e38839c7..f54e86ff 100644
--- a/src/leap/bitmask/logs/utils.py
+++ b/src/leap/bitmask/logs/utils.py
@@ -37,19 +37,18 @@ from logbook.more import ColorizedStderrHandler
from logbook.queues import ZeroMQSubscriber
-# NOTE: make sure that the folder exists, the logger is created before saving
-# settings on the first run.
-_base = os.path.join(get_path_prefix(), "leap")
-mkdir_p(_base)
-BITMASK_LOG_FILE = os.path.join(_base, 'bitmask.log')
-
-
def get_logger(perform_rollover=False):
"""
Push to the app stack the needed handlers and return a Logger object.
:rtype: logbook.Logger
"""
+ # NOTE: make sure that the folder exists, the logger is created before
+ # saving settings on the first run.
+ _base = os.path.join(get_path_prefix(), "leap")
+ mkdir_p(_base)
+ bitmask_log_file = os.path.join(_base, 'bitmask.log')
+
level = logbook.WARNING
if flags.DEBUG:
level = logbook.NOTSET
@@ -65,7 +64,7 @@ def get_logger(perform_rollover=False):
zmq_handler.push_application()
file_handler = logbook.RotatingFileHandler(
- BITMASK_LOG_FILE, format_string=LOG_FORMAT, bubble=True,
+ bitmask_log_file, format_string=LOG_FORMAT, bubble=True,
filter=silencer.filter, max_size=sys.maxint)
if perform_rollover: