Repository navigation
Pass the caller's logger to default transports in New and cluster.StartWith - #33
Merged
thrawn01 merged 1 commit intoOct 29, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Follow-up to #28. A caller who passes
Options.Loggerwithout aTransportexpects the transport's "Listening on…" and server-error messages in that logger. Two paths still sent them toslog.Default():groupcache.New()built its default transport with empty options.cluster.StartWithbuilt the parent transport with empty options. Daemon 1 got the Use provided logger in daemon constructor #28 default, but daemons 2..N come fromparent.New(), which copies the parent's empty options.With no logger the behavior is unchanged (
slog.Default()).cmd/server/main.gois untouched, as it already usesslog.Default().Implementation
instance.go: default transport getsLogger: opts.Logger.cluster/cluster.go: parent transport getsLogger: opts.Logger.cluster/cluster_test.go:TestStartLogsEveryDaemonToLoggerstarts 3 daemons with a capturing logger and expects 3 "Listening on" lines. It failed before the fix (never reached 3) and passes after.Verified with
go vet ./...andgo test -p 1 -race ./...(all pass). Without-p 1, packages collide on the fixed test ports, which predates this change.Not verified: the
New()change has no test. The default transport is not reachable fromInstance, so no surface test can observe its logger. It is the same one-line change asdaemon.go. No sub-agent review was run, only my own read of the diff.Fixes ENG-580