From 6750c291dba1c0b1c93a321b91fd0f0464bfde80 Mon Sep 17 00:00:00 2001 From: David Allada Date: Sun, 23 Mar 2025 16:49:58 +0000 Subject: [PATCH] Add file based logging in addition to the normal console logs --- common/logger.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/logger.py b/common/logger.py index 184b49d..c03a210 100644 --- a/common/logger.py +++ b/common/logger.py @@ -115,3 +115,13 @@ def setup_logger(): format=_log_formatter, colorize=True, ) + + # Add file logging + _ = logger.add( + "/var/log/tabbyapi/{time}.log", # This will create the file in the project root + level=LOG_LEVEL, + format="{time:YYYY-MM-DD HH:mm:ss.SSS} | {level: <8} | {message}", + rotation="20 MB", # Rotate file when it reaches 10MB + retention="1 week", # Keep logs for 1 week + compression="zip", # Compress rotated logs + )