Skip to content

Commit

Permalink
Clear log file contents on Empty log
Browse files Browse the repository at this point in the history
  • Loading branch information
JaiZed authored Sep 23, 2024
1 parent c69be93 commit 5e08898
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bazarr/app/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,14 @@ def configure_logging(debug=False):
logging.getLogger("rebulk").setLevel(logging.WARNING)
logging.getLogger("stevedore.extension").setLevel(logging.CRITICAL)

def empty_file(filename):
# Open the log file in write mode to clear its contents
with open(filename, 'w'):
pass # Just opening and closing the file will clear it

def empty_log():
fh.doRollover()
empty_file(get_log_file_path())
logging.info('BAZARR Log file emptied')


Expand Down

0 comments on commit 5e08898

Please sign in to comment.