BOSWatch/includes/MyTimedRotatingFileHandler.py

24 lines
562 B
Python
Raw Permalink Normal View History

2015-06-25 21:19:41 +02:00
#!/usr/bin/python
# -*- coding: UTF-8 -*-
2015-06-25 21:19:41 +02:00
#
"""
2015-07-02 09:02:49 +02:00
This Class extended the TimedRotatingFileHandler with the possibility
2015-06-25 21:19:41 +02:00
to change the backupCount after initialization.
@author: Jens Herrmann
"""
import logging
class MyTimedRotatingFileHandler(logging.handlers.TimedRotatingFileHandler):
"""Extended Version of TimedRotatingFileHandler"""
def setBackupCount(self, backupCount):
"""Set/Change backupCount"""
2015-07-02 09:02:49 +02:00
self.backupCount = backupCount
def close(self):
"""Make shure logfile will be flushed"""
self.flush()
super(self.__class__, self).close()