# `NervesHubLink.Extensions.ErrorReports.Handler`
[🔗](https://github.com/nerves-hub/nerves_hub_link/blob/v2.14.0/lib/nerves_hub_link/extensions/error_reports/handler.ex#L5)

The `:logger` handler that feeds
`NervesHubLink.Extensions.ErrorReports.Collector`.

## What it picks up

Log events carrying `crash_reason` metadata, and nothing else. That is what
the runtime attaches when a process dies with an exception, an exit or a
throw: `proc_lib` crash reports, GenServer terminations, failed tasks. It is
also what `Logger.error(msg, crash_reason: {exception, stacktrace})` sets, so
application code that wants to report by hand already has a way in.

Keying on `crash_reason` rather than on the level is deliberate. An error is
not every line logged at `:error` — most of those are text, with nothing to
build a stacktrace or a fingerprint from — and it is not only the ones OTP
labels as crash reports either.

Runs in whichever process is doing the logging, so it does as little as it
can and never logs. A handler that waits charges the application for the
reporting, and a handler that logs never stops.

---

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