File-like object that turns write() calls into logging events.

Note that because event formats are unicode, bytes received via write() are converted to unicode, which is the opposite of what file does.

Instance Variable softspace File-like 'softspace' attribute; zero or one. (type: int)
Method __init__
Method closed Read-only property. Is the file closed?
Method encoding Read-only property. File encoding.
Method mode Read-only property. File mode.
Method newlines Read-only property. Types of newlines encountered.
Method name The name of this file; a repr-style string giving information about its namespace.
Method close Close this file so it can no longer be written to.
Method flush No-op; this file does not buffer.
Method fileno Returns an invalid file descriptor, since this is not backed by an FD.
Method isatty A LoggingFile is not a TTY.
Method write Log the given message.
Method writelines Log each of the given lines as a separate message.
Method _unsupported Template for unsupported operations.
softspace =
File-like 'softspace' attribute; zero or one. (type: int)
def __init__(self, logger, level=LogLevel.info, encoding=None): (source)
Parametersloggerthe logger to log through.
levelthe log level to emit events with.
encodingThe encoding to expect when receiving bytes via write(). If None, use sys.getdefaultencoding(). (type: str)
logThe logger to send events to. (type: Logger)
@property
def closed(self): (source)

Read-only property. Is the file closed?

Returnstrue if closed, otherwise false. (type: bool)
@property
def encoding(self): (source)

Read-only property. File encoding.

Returnsan encoding. (type: str)
@property
def mode(self): (source)

Read-only property. File mode.

Returns"w" (type: str)
@property
def newlines(self): (source)

Read-only property. Types of newlines encountered.

ReturnsNone (type: None)
@property
def name(self): (source)

The name of this file; a repr-style string giving information about its namespace.

ReturnsA file name. (type: str)
def close(self): (source)

Close this file so it can no longer be written to.

def flush(self): (source)

No-op; this file does not buffer.

def fileno(self): (source)

Returns an invalid file descriptor, since this is not backed by an FD.

Returns-1 (type: int)
def isatty(self): (source)

A LoggingFile is not a TTY.

ReturnsFalse (type: bool)
def write(self, string): (source)

Log the given message.

ParametersstringData to write. (type: bytes in this file's preferred encoding or unicode)
def writelines(self, lines): (source)

Log each of the given lines as a separate message.

ParameterslinesData to write. (type: iterable of unicode or bytes in this file's declared encoding)
def _unsupported(self, *args): (source)

Template for unsupported operations.

ParametersargsArguments. (type: tuple of object)
API Documentation for Twisted, generated by pydoctor at 2018-07-14 04:53:34.