Skip to content

Commit

Permalink
[chore][stanza/fileconsumer] improve logging (open-telemetry#35846)
Browse files Browse the repository at this point in the history
If any error is encountered while processing a token, the log message
would look like:

`2024-10-01T14:57:41.620+0100 error reader/reader.go:140 process: %w
error-message`

There's no need for `%w` and we can remove it.
  • Loading branch information
VihasMakwana authored and sbylica-splunk committed Dec 17, 2024
1 parent 615f97d commit 67a75ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/stanza/fileconsumer/internal/reader/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (r *Reader) ReadToEnd(ctx context.Context) {

token, err := r.decoder.Decode(s.Bytes())
if err != nil {
r.set.Logger.Error("decode: %w", zap.Error(err))
r.set.Logger.Error("Failed to decode token", zap.Error(err))
r.Offset = s.Pos() // move past the bad token or we may be stuck
continue
}
Expand All @@ -145,7 +145,7 @@ func (r *Reader) ReadToEnd(ctx context.Context) {
}

if !errors.Is(err, header.ErrEndOfHeader) {
r.set.Logger.Error("process: %w", zap.Error(err))
r.set.Logger.Error("Failed to process token", zap.Error(err))
r.Offset = s.Pos() // move past the bad token or we may be stuck
continue
}
Expand Down

0 comments on commit 67a75ac

Please sign in to comment.