mirror of
https://github.com/Project-Babble/ProjectBabble.git
synced 2026-11-20 00:51:16 -08:00
Fix: Include system info after log rollover
This commit is contained in:
1 parent
e9c0a1ba26
commit
d669502f59
1 file changed
+6
-1
+6
-1
@@ -38,6 +38,11 @@ def log_system_info(logger):
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to log system information: {e}")
|
||||
|
||||
class _RotatingFileHandler(RotatingFileHandler):
|
||||
def doRollover(self):
|
||||
super().doRollover()
|
||||
# Include system info after rollover
|
||||
log_system_info(logging.getLogger("debug_logger"))
|
||||
|
||||
def setup_logging():
|
||||
# Log to program directory
|
||||
@@ -49,7 +54,7 @@ def setup_logging():
|
||||
logger = logging.getLogger("debug_logger")
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
file_handler = RotatingFileHandler(log_file, mode='w', maxBytes=2000000, backupCount=1, encoding='utf-8')
|
||||
file_handler = _RotatingFileHandler(log_file, mode='w', maxBytes=2000000, backupCount=1, encoding='utf-8')
|
||||
file_handler.setLevel(logging.DEBUG)
|
||||
formatter = logging.Formatter('%(asctime)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
|
||||
file_handler.setFormatter(formatter)
|
||||
|
||||
Reference in new issue
Block a user