twisted.logger.LimitedHistoryLogObserver(object)
class documentationtwisted.logger
View Source
(View In Hierarchy)
Implements interfaces: twisted.logger.ILogObserver
ILogObserver
that stores events in a buffer of a fixed size:
>>> from twisted.logger import LimitedHistoryLogObserver >>> history = LimitedHistoryLogObserver(5) >>> for n in range(10): history({'n': n}) ... >>> repeats = [] >>> history.replayTo(repeats.append) >>> len(repeats) 5 >>> repeats [{'n': 5}, {'n': 6}, {'n': 7}, {'n': 8}, {'n': 9}] >>>
Method | __init__ | |
Method | __call__ | Log an event. |
Method | replayTo | Re-play the buffered events to another log observer. |
Log an event.
Parameters | event | A dictionary with arbitrary keys as defined by the application emitting
logging events, as well as keys added by the logging system. The logging
system reserves the right to set any key beginning with the prefix
"log_" ; applications should not use any key so
named. Currently, the following keys are used by the logging system in
some way, if they are present (they are all optional):
dict with (native) str keys.) |
Re-play the buffered events to another log observer.
Parameters | otherObserver | An observer to replay events to. (type: ILogObserver ) |