summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/logs/utils.py
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2015-06-22 16:58:19 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2015-06-22 16:58:19 -0300
commite7bda574b308c08dc5a61941b850442c43a17bd4 (patch)
treefcf61bf344acf0040be8b4072ba23f3628a36d04 /src/leap/bitmask/logs/utils.py
parent8de9387861bbb2f450befa78f4343b0a294b96f2 (diff)
[bug] make sure log path exists
The logger is the first thing to be created and on a first run the config path won't exist. This way we make sure the path always exists.
Diffstat (limited to 'src/leap/bitmask/logs/utils.py')
-rw-r--r--src/leap/bitmask/logs/utils.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/leap/bitmask/logs/utils.py b/src/leap/bitmask/logs/utils.py
index d3aa322b..87d33876 100644
--- a/src/leap/bitmask/logs/utils.py
+++ b/src/leap/bitmask/logs/utils.py
@@ -28,12 +28,17 @@ from leap.bitmask.logs.safezmqhandler import SafeZMQHandler
# from leap.bitmask.logs.streamtologger import StreamToLogger
from leap.bitmask.platform_init import IS_WIN
from leap.bitmask.util import get_path_prefix
+from leap.common.files import mkdir_p
import logbook
from logbook.more import ColorizedStderrHandler
-BITMASK_LOG_FILE = os.path.join(get_path_prefix(), "leap", 'bitmask.log')
+# 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):