Errorgap (errorgap v0.2.0)

Copy Markdown View Source

Elixir notifier for Errorgap. Configure via Application env, then call Errorgap.notify/2 directly, attach Errorgap.Plug to your Phoenix endpoint, or wire Errorgap.LoggerHandler into :logger for handler-style capture of crash reports and high-severity logs.

Beyond exceptions, the SDK ships source-aware backtraces, nested causes, breadcrumbs (add_breadcrumb/3), structured logs (log/3), and APM transactions (notify_transaction/2).

Summary

Functions

Record a diagnostic breadcrumb attached to subsequent notices built in this process as context.breadcrumbs.

Clear the current process's breadcrumbs.

Block until all queued notices have been delivered. Use during graceful shutdown.

Deliver a structured log line at the given level with an optional source.

Report an exception or string error to Errorgap. Returns :ok when the notice is queued or successfully delivered, {:error, reason} otherwise.

Functions

add_breadcrumb(message, category \\ nil, metadata \\ %{})

@spec add_breadcrumb(binary(), binary() | atom() | nil, map()) :: :ok

Record a diagnostic breadcrumb attached to subsequent notices built in this process as context.breadcrumbs.

clear_breadcrumbs()

@spec clear_breadcrumbs() :: :ok

Clear the current process's breadcrumbs.

flush(timeout \\ 5000)

@spec flush(timeout()) :: :ok

Block until all queued notices have been delivered. Use during graceful shutdown.

log(message, level \\ "info", source \\ nil, opts \\ [])

@spec log(binary(), binary() | atom(), binary() | nil, keyword()) ::
  :ok | {:error, term()} | {:ok, map()}

Deliver a structured log line at the given level with an optional source.

notify(error, opts \\ [])

@spec notify(
  Exception.t() | binary(),
  keyword()
) :: :ok | {:error, term()} | {:ok, map()}

Report an exception or string error to Errorgap. Returns :ok when the notice is queued or successfully delivered, {:error, reason} otherwise.

Options include :stacktrace, :context, :environment, :session, :params, :cause (an exception whose :cause chain is flattened into context.causes), :breadcrumbs, and :sync.

notify_transaction(transaction, opts \\ [])

@spec notify_transaction(
  map(),
  keyword()
) :: :ok | {:error, term()} | {:ok, map()}

Deliver an APM transaction. Build one with Errorgap.Transaction.web/4 or Errorgap.Transaction.job/3.

version()