summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/frontend_app.py
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/frontend_app.py
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/frontend_app.py')
-rw-r--r--src/leap/bitmask/frontend_app.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/leap/bitmask/frontend_app.py b/src/leap/bitmask/frontend_app.py
index fed24cfa..60391f50 100644
--- a/src/leap/bitmask/frontend_app.py
+++ b/src/leap/bitmask/frontend_app.py
@@ -31,10 +31,8 @@ from leap.bitmask.gui.mainwindow import MainWindow
from leap.bitmask.logs.utils import get_logger
from leap.bitmask.util import dict_to_flags
-logger = get_logger()
-
-def signal_handler(window, pid, signum, frame):
+def signal_handler(window, pid, logger, signum, frame):
"""
Signal handler that quits the running app cleanly.
@@ -42,6 +40,8 @@ def signal_handler(window, pid, signum, frame):
:type window: MainWindow
:param pid: process id of the main process.
:type pid: int
+ :param logger: the logger object to use for logging
+ :type logger: logbook.Logger
:param signum: number of the signal received (e.g. SIGINT -> 2)
:type signum: int
:param frame: current stack frame
@@ -70,6 +70,7 @@ def run_frontend(options, flags_dict, backend_pid=None):
:type flags_dict: dict
"""
dict_to_flags(flags_dict)
+ logger = get_logger()
start_hidden = options["start_hidden"]
@@ -120,7 +121,7 @@ def run_frontend(options, flags_dict, backend_pid=None):
window = MainWindow(start_hidden=start_hidden, backend_pid=backend_pid)
my_pid = os.getpid()
- sig_handler = partial(signal_handler, window, my_pid)
+ sig_handler = partial(signal_handler, window, my_pid, logger)
signal.signal(signal.SIGINT, sig_handler)
signal.signal(signal.SIGTERM, sig_handler)