# `Mob.NativeLogger`
[🔗](https://github.com/genericjam/mob/blob/master/lib/mob/native_logger.ex#L1)

OTP logger handler that routes Elixir Logger output to the platform's native
system log.

- **Android** — `mob_nif:log/2` → `android.util.Log` → `adb logcat`
- **iOS** — `mob_nif:log/2` → `NSLog` → unified system log (Xcode console,
  `xcrun simctl spawn booted log stream`)

Each message appears with the correct priority level (D/I/W/E) under the
tag `Elixir`. OTP supervision reports, GenServer crashes, and all
`Logger.info/warn/error` calls are captured from the first BEAM instruction,
including boot-time failures that happen before Erlang distribution comes up.

## Usage

Call `install/0` once after `application:start(logger)` in your BEAM entry
point (e.g. `mob_demo.erl`):

    'Elixir.Mob.NativeLogger':install()

On the host Mix environment (`:host` platform) the call is a no-op, so the
same boot file works unchanged during `mix test` and local development.

## Relationship to Erlang distribution

This handler and dist-based log forwarding are complementary. Native logging
is always-on and survives connection drops; dist forwarding surfaces logs in
the mob_dev dashboard. Both can be active simultaneously — OTP supports
multiple logger handlers.

# `install`

```elixir
@spec install(keyword()) :: :ok
```

Installs the native system log handler.

Checks the platform via the NIF; if `:host`, returns `:ok` without adding
any handler. Safe to call multiple times.

Options:
- `:nif` — NIF module to use (default `:mob_nif`; override in tests)

---

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