I need my program to write a new log file every day, and so far, that’s no problem. However, I also want the files to be compressed once they are written and limited to, for example, 7 compressed files. My only doubt is whether the logger provides a method for automatic compression without having to implement it manually.
handler = TimedRotatingFileHandler("my_log.log", when="midnight", interval=1, backupCount=7)