Timber v0.1.4 Timber.ContextEntry

The ContextEntry module formalizes the structure of context stack entries

Most users will not interact directly with this module and will instead use the helper functions provided by the main Timber module. See the Timber module for more information.

Summary

Functions

Presents the context the way it should be encoded. The log ingestion system for Timber expects contexts to be encoded such that their type is the key holding the context specific data

Creates a new context entry for a context stack

Types

context_type()
context_type ::
  :custom |
  :exception |
  :http_request |
  :http_response |
  :organization |
  :sql_query |
  :server |
  :template_render |
  :user
t()
t :: %Timber.ContextEntry{data: context_data, dt: String.t, index: non_neg_integer, type: context_type}

Functions

context_for_encoding(context_entry)

Presents the context the way it should be encoded. The log ingestion system for Timber expects contexts to be encoded such that their type is the key holding the context specific data.

new(timestamp, type, data)

Creates a new context entry for a context stack

The type passed should match the struct for the data. For example, a UserContext struct should always be passed with a :user type. No validation will be done by this function, however.

type_for_data(arg1)
type_for_data(context_data) :: context_type