micro-logger-zap/options.go
Vasiliy Tolstov 2a0e5b2a66 add simple zap logger (#469)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-10 15:35:48 +03:00

33 lines
631 B
Go

package zap
import (
"github.com/micro/go-micro/v2/logger"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
type Options struct {
logger.Options
}
type configKey struct{}
// WithConfig pass zap.Config to logger
func WithConfig(c zap.Config) logger.Option {
return setOption(configKey{}, c)
}
type encoderConfigKey struct{}
// WithEncoderConfig pass zapcore.EncoderConfig to logger
func WithEncoderConfig(c zapcore.EncoderConfig) logger.Option {
return setOption(encoderConfigKey{}, c)
}
type levelKey struct{}
// WithLevel pass log level
func WithLevel(l logger.Level) logger.Option {
return setOption(levelKey{}, l)
}