Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`logger`.`LoggingFile``

class documentation

`class LoggingFile: (source)`

Constructor: `LoggingFile(logger, level, encoding)`

View In Hierarchy

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

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

Method | `__init__` | No summary
Method | `close` | Close this file so it can no longer be written to.
Method | `fileno` | Returns an invalid file descriptor, since this is not backed by an FD.
Method | `flush` | No-op; this file does not buffer.
Method | `isatty` | A `LoggingFile` is not a TTY.
Method | `softspace.setter` | Undocumented
Method | `write` | Log the given message.
Method | `writelines` | Log each of the given lines as a separate message.
Instance Variable | `level` | Undocumented
Instance Variable | `log` | Undocumented
Property | `closed` | Read-only property. Is the file closed?
Property | `encoding` | Read-only property. File encoding.
Property | `mode` | Read-only property. File mode.
Property | `name` | The name of this file; a repr-style string giving information about its namespace.
Property | `newlines` | Read-only property. Types of newlines encountered.
Property | `softspace` | Undocumented
Method | `_unsupported` | Template for unsupported operations.
Instance Variable | `_buffer` | Undocumented
Instance Variable | `_closed` | Undocumented
Instance Variable | `_encoding` | Undocumented
Instance Variable | `_softspace` | Undocumented

def __init__(self, logger: `Logger`, level: `NamedConstant` = LogLevel.info, encoding: `Optional[str]` = None): (source)

Parameters
logger:`Logger` | the logger to log through.
level:`NamedConstant` | the log level to emit events with.
encoding:`Optional[str]` | The encoding to expect when receiving bytes via `write()`. If `None`, use `sys.getdefaultencoding()`.

def close(self): (source)

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

def fileno(self) -> `int`: (source)

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

Returns
`int` | `-1`

def flush(self): (source)

No-op; this file does not buffer.

def isatty(self) -> `bool`: (source)

A `LoggingFile` is not a TTY.

Returns
`bool` | `False`

@softspace.setter
def softspace(self, value): (source)

Undocumented

def write(self, message: `AnyStr`): (source)

Log the given message.

Parameters
message:`AnyStr` | The message to write.

def writelines(self, lines: `Iterable[AnyStr]`): (source)

Log each of the given lines as a separate message.

Parameters
lines:`Iterable[AnyStr]` | Data to write.

level = (source)

Undocumented

log = (source)

Undocumented

@property
closed: `bool` = (source)

Read-only property. Is the file closed?

@property
encoding: `str` = (source)

Read-only property. File encoding.

@property
mode: `str` = (source)

Read-only property. File mode.

@property
name: `str` = (source)

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

@property
newlines: `None` = (source)

Read-only property. Types of newlines encountered.

@deprecatedProperty(Version('Twisted', 21, 2, 0))
softspace = (source)

Deprecated since version 21.2.0: `softspace` was deprecated in Twisted 21.2.0.

Undocumented

def _unsupported(self, *args: `object`): (source)

Template for unsupported operations.

Parameters
*args:`object` | Arguments.

_buffer = (source)

Undocumented

_closed: `bool` = (source)

Undocumented

_encoding = (source)

Undocumented

_softspace = (source)

Undocumented