Timber v2.0.0-rc1 Timber

The functions in this module are high level convenience functions instended to define the broader / public API of the Timber library. It is recommended to use these functions instead of their deeper counterparts.

Summary

Functions

Adds a context entry to the stack. See Timber::Contexts::CustomContext for examples

Captures the duration in fractional milliseconds since the timer was started. See start_timer/0

Used to time runtime execution. For example, when timing a Timber.Events.HTTPClientRequestEvent

Functions

add_context(data)
add_context(Timber.Context.context_element) :: :ok

Adds a context entry to the stack. See Timber::Contexts::CustomContext for examples.

duration_ms(timer)

Captures the duration in fractional milliseconds since the timer was started. See start_timer/0.

start_timer()

Used to time runtime execution. For example, when timing a Timber.Events.HTTPClientRequestEvent:

timer = Timber.start_timer()
# .... make request
time_ms = Timber.duration_ms(timer)
event = HTTPClientResponseEvent.new(status: 200, time_ms: time_ms)
message = HTTPClientResponseEvent.message(event)
Logger.info(message, event: event)