# `BoopErrorTracker`
[🔗](https://github.com/chrisgreg/boop_error_tracker/blob/v1.0.0/lib/boop_error_tracker.ex#L1)

Sends [ErrorTracker](https://github.com/elixir-error-tracker/error-tracker) errors to your phone
through [Boop](https://github.com/chrisgreg/boop).

ErrorTracker deliberately does not do notifications; this package attaches to the telemetry
events it emits and turns them into Boop events. It never touches ErrorTracker's database or
configuration, and it uses the `boop_ex` client to send.

## Setup

Install `error_tracker` and configure it as usual, then add this package and `boop_ex`:

    config :boop_ex,
      url: System.fetch_env!("BOOP_URL"),
      api_key: System.fetch_env!("BOOP_API_KEY")

    config :boop_error_tracker,
      environment: config_env(),      # tag on every event; default: unknown
      source: "my_app",               # Boop `source`; default "error_tracker"
      notify_on: [:new, :unresolved], # see below
      throttle: :timer.minutes(10)    # per-error minimum gap for :occurrence notifications

The handler attaches automatically when the `:boop_error_tracker` application starts.
Set `enabled: false` to keep it off (for example in test).

## What triggers a notification

ErrorTracker emits telemetry when an error is first seen, when a resolved error comes back,
and for every occurrence. `notify_on` picks which of those become pushes:

  * `:new` — a brand-new error (`[:error_tracker, :error, :new]`). Default on.
  * `:unresolved` — an error that was marked resolved happens again. Default on.
  * `:occurrence` — every occurrence of any error, throttled per error by `throttle`. Default off;
    turn it on if you want to hear about ongoing errors, not just new ones.

Muted errors are never sent. All events use level `:error`; set `level: :critical` to make
pushes prominent.

# `attach`

```elixir
@spec attach() :: :ok | {:error, :already_exists}
```

Attaches the telemetry handler. Called automatically on application start; safe to call again.

# `attached?`

```elixir
@spec attached?() :: boolean()
```

Whether the handler is currently attached.

# `detach`

```elixir
@spec detach() :: :ok | {:error, :not_found}
```

Detaches the telemetry handler.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
