template.add_file_handlerπŸ”—

template.add_file_handler(fname, mode='a', encoding=None, *, verbose=None)πŸ”—

Add a file handler to the logger.

Parameters:
fnamestr | Path

Path to the file where the logging output is saved.

modestr

Mode in which the file is opened.

encodingstr | None

If not None, encoding used to open the file.

verboseint | str | bool | None

Sets the verbosity level of the file handler. The verbosity increases gradually between "CRITICAL", "ERROR", "WARNING", "INFO" and "DEBUG". If a bool is provided, the verbosity is set to "WARNING" for False and to "INFO" for True. If None is provided, the verbosity of the logger is used.

Notes

Don’t forget to close added file handlers by iterating on logger.handlers and calling handler.close().

Examples using template.add_file_handlerπŸ”—

Logging

Logging