Timber v0.4.5 Timber.Events.CustomEvent

Allows for custom events that aren’t covered elsewhere.

Custom events can be used to encode information about events that are central to your line of business like receiving credit card payments, adding products to a card, saving a draft of a post, or changing a user’s password.

Fields

  • name - This is the name of your event. This can be anything that adheres to the String.Chars' protocol. It will be used to identify this event on the Timber interface. Example::my_eventor orMyEvent. At Timber we like to reserve CamelCase events for actual modules and snake_case events for inline events. *data- A map of data. This can be anything that implemented the [Poison.Encoder](https://hexdocs.pm/poison/2.2.0/Poison.Encoder.html) protocol. That is, anything that can be JSON encoded. example:%{key: “value”}*time_ms- A fractional float represented the execution time in milliseconds. example:45.6## Examples Please see [Timber.Event`](Timber.Event.html) for examples on passing custom event information.

Summary

Functions

Callback implementation for Timber.Event.message/1

Creates a new custom event. Takes any of the fields described in the module docs as keys

Types

t()
t :: %Timber.Events.CustomEvent{data: map | nil, message: String.t, name: String.t, time_ms: float | nil}

Functions

message(map)

Callback implementation for Timber.Event.message/1.

new(opts)
new(Keyword.t) :: t

Creates a new custom event. Takes any of the fields described in the module docs as keys.

Additional options

  • timer - The value returned when calling Timber.Timer.start(). By passing this time_ms will automatically be set for you.