mirror of
https://github.com/borgbase/vorta
synced 2025-02-21 22:06:57 +00:00
parent
4f799ed63f
commit
b470d84c50
1 changed files with 5 additions and 1 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
import os
|
||||
import logging
|
||||
from logging.handlers import TimedRotatingFileHandler
|
||||
from .config import LOG_DIR
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
@ -23,7 +24,10 @@ def init_logger(foreground=False):
|
|||
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||
|
||||
# create handlers
|
||||
fh = logging.FileHandler(os.path.join(LOG_DIR, 'vorta.log'))
|
||||
fh = TimedRotatingFileHandler(os.path.join(LOG_DIR, 'vorta.log'),
|
||||
when='d',
|
||||
interval=1,
|
||||
backupCount=5)
|
||||
fh.setLevel(logging.DEBUG)
|
||||
fh.setFormatter(formatter)
|
||||
logger.addHandler(fh)
|
||||
|
|
Loading…
Reference in a new issue