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`.`log`.`LogPublisher``

class documentation

`class LogPublisher: (source)`

View In Hierarchy

Class for singleton log message publishing.

Method | `__init__` | Undocumented
Method | `addObserver` | Add a new observer.
Method | `msg` | Log a new message.
Method | `removeObserver` | Remove an observer.
Class Variable | `synchronized` | Undocumented
Instance Variable | `showwarning` | Undocumented
Property | `observers` | Property returning all observers registered on this `LogPublisher`.
Method | `_startLogging` | Begin logging to the `LogBeginner` associated with this `LogPublisher`.
Method | `_stopLogging` | Clean-up hook for fixing potentially global state. Only for testing of this module itself. If you want less global state, use the new warnings system in `twisted.logger`.
Instance Variable | `_legacyObservers` | Undocumented
Instance Variable | `_logBeginner` | Undocumented
Instance Variable | `_observerPublisher` | Undocumented
Instance Variable | `_oldshowwarning` | Undocumented
Instance Variable | `_publishPublisher` | Undocumented
Instance Variable | `_warningsModule` | Undocumented

def __init__(self, observerPublisher=None, publishPublisher=None, logBeginner=None, warningsModule=warnings): (source)

Undocumented

def addObserver(self, other): (source)

Add a new observer.

Parameters
other:Provider of `ILogObserver` | A callable object that will be called with each new log message (a dict).

def msg(self, *message, **kw): (source)

Log a new message.

The message should be a native string, i.e. bytes on Python 2 and Unicode on Python 3. For compatibility with both use the native string syntax, for example:

        >>> log.msg('Hello, world.')

You MUST avoid passing in Unicode on Python 2, and the form:

        >>> log.msg('Hello ', 'world.')

This form only works (sometimes) by accident.

Keyword arguments will be converted into items in the event dict that is passed to `ILogObserver` implementations. Each implementation, in turn, can define keys that are used by it specifically, in addition to common keys listed at `ILogObserver.__call__`.

For example, to set the `system` parameter while logging a message:

    >>> log.msg('Started', system='Foo')

def removeObserver(self, other): (source)

Remove an observer.

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

Undocumented

showwarning = (source)

Undocumented

@property
observers: `list` of `callable` = (source)

Property returning all observers registered on this `LogPublisher`.

def _startLogging(self, other, setStdout): (source)

Begin logging to the `LogBeginner` associated with this `LogPublisher`.

Parameters
other:`LogBeginner` | the observer to log to.
setStdout:`bool` | if true, send standard I/O to the observer as well.

def _stopLogging(self): (source)

Clean-up hook for fixing potentially global state. Only for testing of this module itself. If you want less global state, use the new warnings system in `twisted.logger`.

_legacyObservers: `list` = (source)

Undocumented

_logBeginner = (source)

Undocumented

_observerPublisher = (source)

Undocumented

_oldshowwarning = (source)

Undocumented

_publishPublisher = (source)

Undocumented

_warningsModule = (source)

Undocumented