MCPcopy
hub / github.com/uber-go/zap / newJSONEncoder

Function newJSONEncoder

zapcore/json_encoder.go:81–98  ·  view source on GitHub ↗
(cfg EncoderConfig, spaced bool)

Source from the content-addressed store, hash-verified

79}
80
81func newJSONEncoder(cfg EncoderConfig, spaced bool) *jsonEncoder {
82 if cfg.SkipLineEnding {
83 cfg.LineEnding = ""
84 } else if cfg.LineEnding == "" {
85 cfg.LineEnding = DefaultLineEnding
86 }
87
88 // If no EncoderConfig.NewReflectedEncoder is provided by the user, then use default
89 if cfg.NewReflectedEncoder == nil {
90 cfg.NewReflectedEncoder = defaultReflectedEncoder
91 }
92
93 return &jsonEncoder{
94 EncoderConfig: &cfg,
95 buf: bufferpool.Get(),
96 spaced: spaced,
97 }
98}
99
100func (enc *jsonEncoder) AddArray(key string, arr ArrayMarshaler) error {
101 enc.addKey(key)

Callers 2

NewJSONEncoderFunction · 0.85
NewConsoleEncoderFunction · 0.85

Calls 1

GetMethod · 0.45

Tested by

no test coverage detected