Tools for saving and loading log events in a structured format.

Function failureAsJSON Convert a failure to a JSON-serializable data structure.
Function asBytes No summary
Function failureFromJSON Load a Failure from a dictionary deserialized from JSON.
Function objectLoadHook Dictionary-to-object-translation hook for certain value types used within the logging system.
Function objectSaveHook Object-to-serializable hook for certain value types used within the logging system.
def failureAsJSON(failure): (source)

Convert a failure to a JSON-serializable data structure.

ParametersfailureA failure to serialize. (type: Failure)
Returnsa mapping of strings to ... stuff, mostly reminiscent of Failure.__getstate__ (type: dict)
def asBytes(obj): (source)

On Python 2, we really need native strings in a variety of places; attribute names will sort of work in a __dict__, but they're subtly wrong; however, printing tracebacks relies on I/O to containers that only support bytes. This function converts _all_ native strings within a JSON-deserialized object to bytes.

ParametersobjAn object to convert to bytes. (type: object)
ReturnsA string of UTF-8 bytes. (type: bytes)
def failureFromJSON(failureDict): (source)

Load a Failure from a dictionary deserialized from JSON.

ParametersfailureDicta JSON-deserialized object like one previously returned by failureAsJSON. (type: dict mapping unicode to attributes)
ReturnsFailure (type: Failure)
def objectLoadHook(aDict): (source)

Dictionary-to-object-translation hook for certain value types used within the logging system.

ParametersaDictA dictionary loaded from a JSON object. (type: dict)
ReturnsaDict itself, or the object represented by aDict (type: object)
See Alsothe object_hook parameter to json.load
def objectSaveHook(pythonObject): (source)

Object-to-serializable hook for certain value types used within the logging system.

ParameterspythonObjectAny object. (type: object)
ReturnsIf the object is one of the special types the logging system supports, a specially-formatted dictionary; otherwise, a marker dictionary indicating that it could not be serialized.
See Alsothe default parameter to json.dump
API Documentation for Twisted, generated by pydoctor at 2018-07-14 04:53:34.