uber-go / zap

Blazing fast, structured, leveled logging in Go.
https://pkg.go.dev/go.uber.org/zap
MIT License
22.1k stars 1.44k forks source link

Add option to override sink and encoder (#1438) #1439

Open dkropachev opened 6 months ago

dkropachev commented 6 months ago

Closes https://github.com/uber-go/zap/issues/1438 Makes it possible to override/wrap encoder:

    zap.NewProductionConfig().Build(zap.WrapEncoder(func(encoding string, cfg zapcore.EncoderConfig, encoder zapcore.Encoder) (zapcore.Encoder, error) {
        ....
    }))

And sink

    zap.NewProductionConfig().Build(zap.WrapSinker(func(paths []string, sink zapcore.WriteSyncer, errPath []string, errSink zapcore.WriteSyncer) (zapcore.WriteSyncer, zapcore.WriteSyncer, error) {
        ...
    }))
CLAassistant commented 6 months ago

CLA assistant check
All committers have signed the CLA.