Take the console location from the record (closes #36)
ConsoleHandler found the file and line it prints by walking a fixed number of stack frames up from itself, which only fit a record logged through a slog.Logger and delivered through MultiplexHandler. It now reads them from the record's PC, the call site slog stores, so a ConsoleHandler used with slog.New and a record passed to Handle directly print the right location too. A record whose PC is zero prints ???:0 as before. The README drops its warning about the wrong location and says how to set PC instead. Model: opus-5-5
This commit is contained in:
@@ -24,6 +24,10 @@ files it depends on: .golangci.yml, REPO_POLICIES.md, .editorconfig,
|
||||
|
||||
# Completed Steps
|
||||
|
||||
* 2026-10-06: the console handler takes the file and line it prints from
|
||||
the record's `PC` instead of counting stack frames, so they name the
|
||||
call site whether the record came through a `slog.Logger` or straight
|
||||
to `Handle`
|
||||
* 2026-10-06: the tests run under the race detector, in Docker:
|
||||
`script/test` builds the `test` stage of the `Dockerfile`, which runs
|
||||
`go test -race`, and a new final stage makes a plain `docker build`
|
||||
|
||||
Reference in New Issue
Block a user