Log a failure and emit a traceback.

For example:

   except Exception:
       log.failure("While frobbing {knob}", knob=knob)


   d = deferredFrob(knob)
   d.addErrback(lambda f: log.failure, "While frobbing {knob}",
                f, knob=knob)

This method is generally meant to capture unexpected exceptions in code; an exception that is caught and handled somehow should be logged, if appropriate, via Logger.error instead. If some unknown exception occurs and your code doesn't know how to handle it, as in the above example, then this method provides a means to describe the failure in nerd-speak. This is done at LogLevel.critical by default, since no corrective guidance can be offered to an user/administrator, and the impact of the condition is unknown.

Parametersformata message format using new-style (PEP 3101) formatting. The logging event (which is a dict) is used to render this format string.
failurea Failure to log. If None, a Failure is created from the exception in flight.
levela LogLevel to use.
kwargsadditional key/value pairs to include in the event. Note that values which are later mutated may result in non-deterministic behavior from observers that schedule work for later execution.
API Documentation for Twisted, generated by pydoctor at 2017-09-23 19:45:03.