summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/core/logs.py
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-09-26 18:09:30 -0400
committerKali Kaneko (leap communications) <kali@leap.se>2016-09-26 18:09:30 -0400
commita61019a5d30502a06b3a0ef09ca32044b8d09e2b (patch)
treeaad1f84e8d539ab5b23609e71dcd17d529d6de87 /src/leap/bitmask/core/logs.py
parent24e9d3bbc98232062a4233f7f5de4f00cc256242 (diff)
[feature] rotate logs
Diffstat (limited to 'src/leap/bitmask/core/logs.py')
-rw-r--r--src/leap/bitmask/core/logs.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/leap/bitmask/core/logs.py b/src/leap/bitmask/core/logs.py
new file mode 100644
index 00000000..2b42d610
--- /dev/null
+++ b/src/leap/bitmask/core/logs.py
@@ -0,0 +1,14 @@
+from os.path import abspath, join, isfile
+
+from twisted.python import logfile
+
+from leap.common.config import get_path_prefix
+
+
+def loggerFactory():
+ log_path = abspath(join(get_path_prefix(), 'leap', 'bitmaskd.log'))
+ rotate = isfile(log_path)
+ _logfile = logfile.LogFile.fromFullPath(log_path, maxRotatedFiles=5)
+ if rotate:
+ _logfile.rotate()
+ return _logfile