Both handlers discard every slog attribute, so structured logging emits less information than the string logging it replaces #19
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reported by the cattbox manager. Present at upstream
main, not just in the released version, so it is not fixed by the retag in #18.Problem
Both handlers ignore
record.Attrs, and bothWithAttrsimplementations return the receiver unchanged. So:emits the message and silently drops both fields.
Why this is worse than it sounds
CODE_STYLEGUIDE_GO.mdmandates this library org-wide, and the compliance sweep currently under way converts string logging into structured attributes. That conversion looks like this:Before the change, the values were at least present in the message text. After it, they are gone entirely. A repo that correctly follows the styleguide ends up with less information in its logs than it had beforehand — and the code will review as correct, because it is correct. The library throws the data away.
Every repo the sweep converts loses log content this way, invisibly.
Definition of done
record.Attrs— as JSON fields inJSONHandler, in the console format forConsoleHandler.WithAttrsaccumulates rather than returning the receiver, and the accumulated attrs appear on every subsequent record from that logger.WithGroupbehaves per theslog.Handlercontract, or its non-support is documented explicitly rather than silently ignored.v1.0.2, with the leadingv— see #18) so consuming repos can move off pseudo-version pins in one step.Sequencing
#18 first: it is a one-command retag that fixes a production hang. This is a code change and should follow. Consuming repos pinning the pseudo-version get the deadlock fix immediately and can pick this up when it lands.
Tracked downstream as cattbox #24.