log.file
import log
Everything here is re-exported by
log, soimport logis enough and the names are called aslog.*. Importinglog.fileon its own works too and reaches the same definitions.
FileTransport: sends log streams to a file on disk, with optional
size-based rotation.
Classes
FileTransport
class log.FileTransport < Transport
FileTransport is a log transport that facilitates sending log streams to an on-disk file.
Fields
| Field | Type | Description |
|---|---|---|
file |
Constructor
log.FileTransport(path: string)
Returns a new instance of FileTransport and opens a file handle to the the file specified in the path.
Parameters
path(string)
FileTransport.set_max_bytes()
log.FileTransport.set_max_bytes(n: ?number)
Sets the size, in bytes, past which the log file is rotated to
<path>.1 (shifting any existing numbered backups up by one) and a
fresh file is opened at path. Rotation is disabled (nil) by default.
Parameters
n(?number)
Returns — self
FileTransport.set_backup_count()
log.FileTransport.set_backup_count(n: number)
Sets how many rotated backups (<path>.1 through <path>.<n>) are
kept. The oldest backup beyond this count is deleted on the next
rotation. Default: 5.
Parameters
n(number)
Returns — self
FileTransport.write()
log.FileTransport.write(message, level)
FileTransport.flush()
log.FileTransport.flush()
FileTransport.close()
log.FileTransport.close()