Skip to content

Commit

Permalink
errs
Browse files Browse the repository at this point in the history
  • Loading branch information
paulwe committed Oct 5, 2024
1 parent 635aae2 commit 8f7ee7c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions logger/objectslice.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@

package logger

import "go.uber.org/zap/zapcore"
import (
"go.uber.org/multierr"
"go.uber.org/zap/zapcore"
)

func ObjectSlice[T zapcore.ObjectMarshaler](s []T) zapcore.ArrayMarshaler {
return objectSlice[T](s)
Expand All @@ -23,8 +26,9 @@ func ObjectSlice[T zapcore.ObjectMarshaler](s []T) zapcore.ArrayMarshaler {
type objectSlice[T zapcore.ObjectMarshaler] []T

func (a objectSlice[T]) MarshalLogArray(e zapcore.ArrayEncoder) error {
var err error
for _, o := range a {
e.AppendObject(o)
err = multierr.Append(err, e.AppendObject(o))
}
return nil
return err
}

0 comments on commit 8f7ee7c

Please sign in to comment.