Go to the latest version of this document.

# ``twisted`.`internet`.`testing`.`EventLoggingObserver``

class documentation

`class EventLoggingObserver(Sequence[LogEvent]): (source)`

Constructor: `EventLoggingObserver.createWithCleanup(testInstance, publisher)`

Implements interfaces: `twisted.logger.ILogObserver`

View In Hierarchy

`ILogObserver` That stores its events in a list for later inspection. This class is similar to `LimitedHistoryLogObserver` save that the internal buffer is public and intended for external inspection. The observer implements the sequence protocol to ease iteration of the events.

Class Method | `createWithCleanup` | Create an `EventLoggingObserver` instance that observes the provided publisher and will be cleaned up with addCleanup().
Method | `__call__` | No summary
Method | `__getitem__` | Undocumented
Method | `__init__` | Undocumented
Method | `__iter__` | Undocumented
Method | `__len__` | Undocumented
Instance Variable | `_events` | The events captured by this observer

@classmethod
def createWithCleanup(cls, testInstance: `TestCase`, publisher: `LogPublisher`) -> `Self`: (source)

Create an `EventLoggingObserver` instance that observes the provided publisher and will be cleaned up with addCleanup().

Parameters
testInstance:`twisted.trial.unittest.TestCase` | Test instance in which this logger is used.
publisher:twisted.logger.LogPublisher | Log publisher to observe.

Returns
`twisted.test.proto_helpers.EventLoggingObserver` | An EventLoggingObserver configured to observe the provided publisher.

def __call__(self, event: `LogEvent`): (source)
from `twisted.logger.ILogObserver`

See Also
`ILogObserver`

@overload
def __getitem__(self, index: `int`) -> `LogEvent`:
@overload
def __getitem__(self, index: `slice`) -> `Sequence[LogEvent]`:
(source)

Undocumented

def __init__(self): (source)

Undocumented

def __iter__(self) -> `Iterator[LogEvent]`: (source)

Undocumented

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

Undocumented

_events: `list` = (source)

The events captured by this observer