Skip to content

Conversation

@davidjsonn
Copy link
Contributor

StructLog.WriteTo now matches io.WriterTo, counts written bytes, and returns the first write failure so go vet stops complaining. Streaming tracers notice those errors via l.Stop(err) and abort cleanly instead of soldiering on with a broken writer. The helper WriteTrace returns once a write fails for consistency. With these tweaks the package builds cleanly under go vet and holds up better when stdout/stderr is misbehaving.

@davidjsonn davidjsonn requested a review from s1na as a code owner November 19, 2025 07:01
@MariusVanDerWijden
Copy link
Member

How are you using the structlogger? It looks a bit like a change for the sake of the change itself instead of a real functional necessary change imo

@davidjsonn
Copy link
Contributor Author

How are you using the structlogger? It looks a bit like a change for the sake of the change itself instead of a real functional necessary change imo

go vet fails on this package with the current toolchain (we run Go 1.24+; go env reports go1.25.1). The exact error is:

eth/tracers/logger/logger.go:98:21: method WriteTo(writer io.Writer) should have signature WriteTo(io.Writer) (int64, error)

So this isn’t “just a test runner” situation—eth/tracers/logger is the public tracer library. Without this patch, vet blocks CI and we silently swallow streaming write errors. Making the method implement io.WriterTo fixes vet and lets us abort the trace when the writer dies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants