Add file based logging in addition to the normal console logs
This commit is contained in:
parent
ccf23243c1
commit
6750c291db
1 changed files with 10 additions and 0 deletions
|
|
@ -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
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue