logging.handlers.WatchedFileHandler

class logging.handlers.WatchedFileHandler(filename, mode='a', encoding=None, delay=False)

Returns a new instance of the WatchedFileHandler class. The specified file is opened and used as the stream for logging. If mode is not specified, 'a' is used. If encoding is not None, it is used to open the file with that encoding. If delay is true, then file opening is deferred until the first call to emit(). By default, the file grows indefinitely.

emit(record)

Outputs the record to the file, but first checks to see if the file has changed. If it has, the existing stream is flushed and closed and the file opened again, before outputting the record to the file.

doc_python
2016-10-07 17:36:18
Comments
Leave a Comment

Please login to continue.