Timber v2.8.1 Timber.Context View Source

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.

The functions in this module work by modifying the Logger metadata store which is unique to every BEAM process. This is convenient in many ways. First and foremost, it does not require you to manually manage the metadata. Second, because we conform to the standard Logger principles, you can utilize Timber alongside other Logger backends without issue. Timber prefixes its contextual metadata keys so as not to interfere with other systems.

Link to this section Summary

Types

Deprecated; please use element instead

t()

Functions

Takes an existing context element and inserts it into the provided context

Merges two Context structs

Removes a key from the provided context structure

Link to this section Types

Link to this section Functions

Link to this function add(context, context_element) View Source
add(t, element) :: t

Takes an existing context element and inserts it into the provided context.

Link to this function merge(context, second_context) View Source
merge(t, t) :: t

Merges two Context structs

Entries in the second Context will override entries in the first. The caveat to this is custom context, which will descend into the custom context and merge it there. Even then, custom context entries in the second will override custom context entries in the first.

Link to this function remove_key(context, key) View Source
remove_key(t, atom) :: t

Removes a key from the provided context structure.