# `MingaClaudeBridge.DebugLog`
[🔗](https://github.com/jsmestad/minga-claude-bridge/blob/main/lib/minga_claude_bridge/debug_log.ex#L1)

Raw protocol logs for debugging, written only when `CLAUDE_BRIDGE_DEBUG=1`.

Each transport writes one file, `<base>/debug/<key>-<timestamp>.log`, with every line it writes to stdin (prefixed `> `) and every line it reads from stdout (prefixed `< `). The directory has mode 0700 and each file 0600, because the lines hold conversation content.

Without the variable nothing is written; the session logs frame types only.

# `t`

```elixir
@type t() :: File.io_device() | nil
```

# `close`

```elixir
@spec close(t()) :: :ok
```

Closes the log file.

# `enabled?`

```elixir
@spec enabled?(%{optional(String.t()) =&gt; String.t()}) :: boolean()
```

Returns true when `env` enables debug logs.

# `open`

```elixir
@spec open(Path.t(), String.t()) :: t()
```

Opens a new log file for session `key` under `base`. Returns `nil` when the file cannot be created.

# `write`

```elixir
@spec write(t(), :in | :out, iodata()) :: :ok
```

Appends one line. `direction` is `:in` for stdout lines and `:out` for stdin lines.

---

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