Skip to content

Commit

Permalink
Fix logrus interceptor (grpc-ecosystem#588)
Browse files Browse the repository at this point in the history
* interceptors: Fix logrus example to iterate over all fields

Fixes grpc-ecosystem#570

Signed-off-by: Chance Zibolski <[email protected]>

* interceptors: Update zap InterceptorLogger to use Iterator properly

The logic in the example is redundant with the logging.Fields Iterator

Signed-off-by: Chance Zibolski <[email protected]>

---------

Signed-off-by: Chance Zibolski <[email protected]>
  • Loading branch information
chancez authored and rahulkhairwar committed Jul 6, 2023
1 parent e895693 commit ea10178
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion interceptors/logging/examples/logrus/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func InterceptorLogger(l logrus.FieldLogger) logging.Logger {
return logging.LoggerFunc(func(_ context.Context, lvl logging.Level, msg string, fields ...any) {
f := make(map[string]any, len(fields)/2)
i := logging.Fields(fields).Iterator()
if i.Next() {
for i.Next() {
k, v := i.At()
f[k] = v
}
Expand Down

0 comments on commit ea10178

Please sign in to comment.