Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions duologsync/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"""

import logging
from logging.handlers import RotatingFileHandler


class ProgramShutdownError(Exception):
"""
Expand Down Expand Up @@ -75,6 +77,11 @@ def setup_logging(cls, log_filepath):
# Date format to use with logs
datefmt='%Y-%m-%d %H:%M:%S'
)

# Log rotation, allows for 3 rotations, each at 25MB.
logger = logging.getLogger()
handler = RotatingFileHandler(log_filepath, maxBytes=26214400, backupCount=3)
logger.addHandler(handler)

except FileNotFoundError as file_not_found_error:
cls.log(f"DuoLogSync: Could not follow the path {log_filepath}. "
Expand Down