def __init__(self, filename=None, directory=None, suffix='.log',
program_name=None, formatter=formatter.TEXT_FORMATTER,
level=None, max_size_bytes=0, backup_count=0):
"""Rotating log file output.
:param filename: The log file path to write to.
If directory is also specified, both will be combined.
:param directory: The log directory to write to.
If no filename is specified, the program name and suffix will be used
to contruct the full path relative to the directory.
:param suffix: The log file name suffix.
This will be only used if no filename has been provided.
:param program_name: Program name. Autodetected by default.
:param max_size_bytes: allow the file to rollover at a
predetermined size.
:param backup_count: the maximum number of files to rotate
logging output between.
"""
logpath = _get_log_file_path(filename, directory,
program_name, suffix)
handler = logging.handlers.RotatingFileHandler(
logpath, maxBytes=max_size_bytes, backupCount=backup_count)
super(RotatingFile, self).__init__(handler, formatter, level)
评论列表
文章目录