MingaClaudeBridge.DebugLog (minga_claude_bridge v0.1.0)

Copy Markdown View Source

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.

Summary

Functions

Closes the log file.

Returns true when env enables debug logs.

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

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

Types

t()

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

Functions

close(device)

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

Closes the log file.

enabled?(env)

@spec enabled?(%{optional(String.t()) => String.t()}) :: boolean()

Returns true when env enables debug logs.

open(base, key)

@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(device, direction, line)

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

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