# `Collector`

Reports your app's errors to Collector.

Add the dependency and the DSN, and crashes are reported on their own:

    {:collector, ">= 0.1.0"}

    # In the deployed app's environment
    COLLECTOR_DSN=https://clt_…@app.clt.chrom.ar

See `Collector.Config` for the other options. Without a DSN, nothing
is sent.

To report something yourself, use `capture_exception/2` or
`capture_message/2`.

# `capture_exception`

Reports an exception you rescued.

    try do
      charge!(order)
    rescue
      e ->
        Collector.capture_exception(e, stacktrace: __STACKTRACE__)
        {:error, :payment_failed}
    end

Options: `:stacktrace`, `:level`, `:fingerprint`, `:tags`, `:user`.

# `capture_message`

Reports something that isn't an exception.

    Collector.capture_message("Payment gateway slow", level: :warning)

Options: `:level` (default `:error`), `:fingerprint`, `:tags`, `:user`.

# `set_user`

Attaches the current user's id to errors reported from this process
(the request, in a web app). An id, not personal data.

    Collector.set_user(current_user.id)

---

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