Timber v2.5.5 Timber.Events.ErrorEvent

The ErrorEvent is used to track errors and exceptions.

The defined structure of this data can be found in the log event JSON schema: https://github.com/timberio/log-event-json-schema

Timber automatically tracks and structures errors and exceptions in your application. Giving you detailed stack traces, context, and error data.

Summary

Functions

Builds a new error event from an error / exception

Builds an error from the given log message. This allows us to create Error events downstream in the logging flow. Because of the complicated nature around Elixir exception handling, this is a reliable catch-all to ensure all error are capture and processed properly

Message to be used when logging

Convenience methods for building error events, taking care to normalize values and ensure they meet the validation requirements of the Timber API

Types

backtrace_entry()
backtrace_entry() :: %{app_name: String.t | nil, function: String.t, file: String.t | nil, line: non_neg_integer | nil}
stacktrace_entry()
stacktrace_entry() :: {module, atom, arity, [file: IO.chardata, line: non_neg_integer] | []}
t()
t() :: %Timber.Events.ErrorEvent{backtrace: [backtrace_entry] | [], message: String.t | nil, metadata_json: binary | nil, name: String.t}

Functions

from_exception(error)
from_exception(Exception.t) :: t

Builds a new error event from an error / exception.

from_log_message(log_message)
from_log_message(String.t) :: {:ok, t} | {:error, atom}

Builds an error from the given log message. This allows us to create Error events downstream in the logging flow. Because of the complicated nature around Elixir exception handling, this is a reliable catch-all to ensure all error are capture and processed properly.

message(error_event)
message(t) :: IO.chardata

Message to be used when logging.

new(name, message, opts \\ [])

Convenience methods for building error events, taking care to normalize values and ensure they meet the validation requirements of the Timber API.