class documentation

class LimitedHistoryLogObserver: (source)

Implements interfaces: twisted.logger.ILogObserver

View In Hierarchy

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.
Instance Variable _buffer Undocumented
def __init__(self, size=_DEFAULT_BUFFER_MAXIMUM): (source)
ParameterssizeThe maximum number of events to buffer. If None, the buffer is unbounded. (type: Optional[int])
_buffer = (source)

Undocumented

(type: Deque[LogEvent])
def __call__(self, event): (source)

Log an event.

ParameterseventA 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):
  • "log_format": a PEP-3101-style format string which draws upon the keys in the event as its values, used to format the event for human consumption.
  • "log_flattened": a dictionary mapping keys derived from the names and format values used in the "log_format" string to their values. This is used to preserve some structured information for use with twisted.logger.extractField.
  • "log_trace": A list designed to capture information about which LogPublishers have observed the event.
  • "log_level": a log level constant, indicating the importance of and audience for this event.
  • "log_namespace": a namespace for the emitter of the event, given as a str.
  • "log_system": a string indicating the network event or method call which resulted in the message being logged.
(type: LogEvent)
def replayTo(self, otherObserver): (source)

Re-play the buffered events to another log observer.

ParametersotherObserverAn observer to replay events to. (type: ILogObserver)
API Documentation for Twisted, generated by pydoctor 21.2.0 at 2021-02-28 21:00:42.