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`.`python`.`logfile`.`BaseLogFile``

class documentation

`class BaseLogFile: (source)`

Known subclasses: `twisted.python.logfile.DailyLogFile`, `twisted.python.logfile.LogFile`

View In Hierarchy

The base class for a log file that can be rotated.

Class Method | `fromFullPath` | Construct a log file from a full file path.
Method | `__init__` | Create a log file.
Method | `close` | Close the file.
Method | `flush` | Flush the file.
Method | `getCurrentLog` | Return a LogReader for the current log file.
Method | `reopen` | Reopen the log file. This is mainly useful if you use an external log rotation tool, which moves under your feet.
Method | `shouldRotate` | Override with a method to that returns true if the log should be rotated.
Method | `write` | Write some data to the file.
Class Variable | `synchronized` | Undocumented
Instance Variable | `closed` | Undocumented
Instance Variable | `defaultMode` | Undocumented
Instance Variable | `directory` | Undocumented
Instance Variable | `name` | Undocumented
Instance Variable | `path` | Undocumented
Method | `_openFile` | Open the log file.
Instance Variable | `_file` | Undocumented

@classmethod
def fromFullPath(cls, filename, *args, **kwargs): (source)

Construct a log file from a full file path.

def __init__(self, name, directory, defaultMode=None): (source)
overridden in `twisted.python.logfile.LogFile`

Create a log file.

Parameters
name:`str` | name of the file
directory:`str` | directory holding the file
defaultMode:`Optional[int]` | permissions used to create the file. Default to current permissions of the file if the file exists.

def close(self): (source)

Close the file.

The file cannot be used once it has been closed.

def flush(self): (source)

Flush the file.

def getCurrentLog(self): (source)

Return a LogReader for the current log file.

def reopen(self): (source)

Reopen the log file. This is mainly useful if you use an external log rotation tool, which moves under your feet.

Note that on Windows you probably need a specific API to rename the file, as it's not supported to simply use os.rename, for example.

def shouldRotate(self): (source)
overridden in `twisted.python.logfile.DailyLogFile`, `twisted.python.logfile.LogFile`

Override with a method to that returns true if the log should be rotated.

def write(self, data): (source)
overridden in `twisted.python.logfile.DailyLogFile`, `twisted.python.logfile.LogFile`

Write some data to the file.

Parameters
data:`bytes` or `unicode` | The data to write. Text will be encoded as UTF-8.

synchronized: `list[str]` = (source)

Undocumented

closed: `bool` = (source)

Undocumented

defaultMode: `Optional[int]` = (source)

Undocumented

directory = (source)

Undocumented

name = (source)

Undocumented

path = (source)

Undocumented

def _openFile(self): (source)
overridden in `twisted.python.logfile.DailyLogFile`, `twisted.python.logfile.LogFile`

Open the log file.

The log file is always opened in binary mode.

_file = (source)

Undocumented