Skip to content

Commit

Permalink
Use faster encoder (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
liranbg authored Jan 17, 2022
1 parent 928f541 commit 2958fb9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/nuclio/zap
go 1.17

require (
github.com/goccy/go-json v0.9.3
github.com/liranbg/uberzap v1.20.0-nuclio.1
github.com/logrusorgru/aurora/v3 v3.0.0
github.com/nuclio/errors v0.0.3
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZx
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/goccy/go-json v0.9.3 h1:VYKeLtdIQXWaeTZy5JNGZbVui5ck7Vf5MlWEcflqz0s=
github.com/goccy/go-json v0.9.3/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
Expand Down
4 changes: 4 additions & 0 deletions logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"strings"
"time"

gojson "github.com/goccy/go-json"
"github.com/liranbg/uberzap"
"github.com/liranbg/uberzap/zapcore"
"github.com/logrusorgru/aurora/v3"
Expand Down Expand Up @@ -419,6 +420,9 @@ func (nz *NuclioZap) getEncoderConfig(encoding string, encoderConfig *EncoderCon
EncodeDuration: zapcore.SecondsDurationEncoder,
EncodeCaller: func(zapcore.EntryCaller, zapcore.PrimitiveArrayEncoder) {},
EncodeName: zapcore.FullNameEncoder,
NewReflectedEncoder: func(writer io.Writer) zapcore.ReflectedEncoder {
return gojson.NewEncoder(writer)
},
}
}

Expand Down

0 comments on commit 2958fb9

Please sign in to comment.