Documentation
¶
Overview ¶
Package httplog logs every HTTP request the proxy makes or serves.
Two wrappers cover the two directions: Transport logs outbound requests (to Anthropic, to the Codex backend, to the OAuth token endpoint — anything dialed through it), and Log wraps an http.Handler to log inbound requests (everything Claude Code sends the proxy). Both log the same fields — method, URL, request/response size, status, duration — so the two directions read the same way in the log.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Transport ¶
type Transport struct {
// Next is the transport to call. http.DefaultTransport is used when nil.
Next http.RoundTripper
// Label tags each log line, so requests from different clients (the
// codex backend, the OAuth token endpoint, plain pass-through) can be
// told apart at a glance.
Label string
}
Transport wraps an http.RoundTripper to log every request it sends.
The response is logged when its body is closed, not when RoundTrip returns: a streaming response (Codex's Responses API never sends Content-Length) would otherwise be logged with an unknown size, or would have to be buffered in full just to count it. Logging on Close reports the real transferred size and the real duration — including how long a stream stayed open — at the cost of nothing appearing in the log for a response whose body a caller never closes. Every call site in this codebase closes its response bodies, so that cost is not paid in practice.