65ffb96c
log: slog through auxilia's scribe, not logrus
This was the last service on the instance still logging through logrus, and the ecore bump made it a correctness question rather than a consistency one: the recovery middleware reports a panic through slog's DEFAULT logger, so without a SetDefault the one record carrying a stack trace would have gone to Go's plain handler while every other line went through logrus. initLogging installs a scribe tint handler on stderr — source on, colour only when stderr is a terminal, and the mask rules for token, cookie and authorization. It reads -d out of the argument vector rather than waiting for core-go's parse, because a daemon that only became verbose after it had finished starting would be silent for exactly the part of its life an operator passes -d to watch. Terminal detection is a stdlib Stat rather than golang.org/x/term, which would be a new dependency for one predicate. The startup config check keeps its shape deliberately: it still accumulates every missing key and reports them in ONE record before ONE exit, so an operator fixes the config in a single pass. The keys go in as a slice attribute rather than a joined string, so the structured sinks keep them as a list. culpa goes in at the one boundary where it pays: the errors web.New returns, which are the only errors this package produces and all of which arrive at that single startup record. Each carries a hint naming the config key or the build step that fixes it, and scribe.Err unfolds message, code, hint and stacktrace into fields of their own. The failing request path logs the same way, with ErrorContext so a cancelled request reads as cancelled rather than as an unexplained 500. TestPanicIsAnErrorPage covers the wiring end to end through Register: a panicking authorizer yields the chrome-wrapped 500, the panic value does not reach the viewer, and the report reaches slog's default logger.
bigbes <bigbes@gmail.com> — 2026-08-08 19:54:46 UTC
Commit 65ffb96c316be74225e3405ca5f9ef2ab68825f9 —
view raw patch
Parent(s):
0b9a8233
| File | Status | + | − |
|---|---|---|---|
cmd/comparesrht/main.go
|
M | +69 | -14 |
go.mod
|
M | +6 | -6 |
go.sum
|
M | +14 | -14 |
web/handlers.go
|
M | +8 | -2 |
web/server.go
|
M | +29 | -11 |
web/templates.go
|
M | +3 | -2 |
web/web_test.go
|
M | +40 |