Go to file
Peter J. Holzer 7d8bcbd5bf Implement TimeoutSwitchingFileHandler 2022-12-03 12:19:00 +01:00
README.md Implement TimeoutSwitchingFileHandler 2022-12-03 12:19:00 +01:00
timeoutswitchingfilehandler.py Implement TimeoutSwitchingFileHandler 2022-12-03 12:19:00 +01:00

README.md

TimeoutSwitchingFileHandler

This is a logging file handler for the Python logging system. It automatically closes the log file after a period of inactivity (or after the file has been open for some time whichever comes first) and then opens a new file at the next emit.

This is useful for long-running processes where short periods of activity alternate with periods of inactivity. Log switchs will typically occur during inactivity, so each log file will include one complete active period. Also, since the log files are closed, they can be safely compressed or removed.