12 lines
416 B
Python
12 lines
416 B
Python
|
import logging
|
||
|
|
||
|
|
||
|
class CustomFileHandler(logging.FileHandler):
|
||
|
def _get_or_create_filename(self, suffix):
|
||
|
# Override the method to include the date in the filename
|
||
|
if self.stream is None:
|
||
|
# Reopen the file with a new filename that includes the date
|
||
|
filename = self.baseFilename + suffix
|
||
|
self.stream = self._open(filename, 'a')
|
||
|
return self.baseFilename
|