lenskit.logging.Tracer#

class lenskit.logging.Tracer(logger)#

Logger-like thing that is only for TRACE-level events.

This class is designed to support structured tracing without the overhead of creating and binding new loggers. It is also imperative, rather than functional, so we create fewer objects and so it is a little more ergonomic for common tracing flows.

Note

Don’t create instances of this class directly — use get_tracer() to create a tracer.

Stability:

Experimental

Parameters:

logger (structlog.stdlib.BoundLogger)

add_bindings(**new_values)#

Bind new data in the keys.

Note

Unlike structlog.Logger.bind(), this method is **imperative*: it updates the tracer in-place instead of returning a new tracer. If you need a new, disconnected tracer, use split().

Parameters:

new_values (Any)

Return type:

None

remove_bindings(*keys)#

Unbind keys in the tracer.

Note

Unlike structlog.Logger.bind(), this method is **imperative*: it updates the tracer in-place instead of returning a new tracer. If you need a new, disconnected tracer, use split().

Parameters:

keys (str)

Return type:

None

reset()#

Reset this tracer’s underlying logger to the original logger.

Return type:

None

trace(event, *args, **bindings)#

Emit a TRACE-level event.

Parameters:
  • event (str)

  • args (Any)

  • bindings (Any)

Return type:

None