summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/core/logs.py
blob: 2b42d61021b2c880a64b74108e0a05667d38957a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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