chore: introduce silent test logger config
This commit is contained in:
parent
fca6cafc44
commit
fcd8e62b40
|
@ -12,8 +12,7 @@ var registerOnce sync.Once
|
||||||
|
|
||||||
// MustCreateTestLogger returns a logger based on the passed flags.
|
// MustCreateTestLogger returns a logger based on the passed flags.
|
||||||
func MustCreateTestLogger() *zap.Logger {
|
func MustCreateTestLogger() *zap.Logger {
|
||||||
cfg := zap.NewDevelopmentConfig()
|
return MustCreateTestLoggerWithConfig(loggerConfig())
|
||||||
return MustCreateTestLoggerWithConfig(cfg)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func MustCreateTestLoggerWithConfig(cfg zap.Config) *zap.Logger {
|
func MustCreateTestLoggerWithConfig(cfg zap.Config) *zap.Logger {
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
//go:build !test_silent
|
||||||
|
|
||||||
|
package tt
|
||||||
|
|
||||||
|
import "go.uber.org/zap"
|
||||||
|
|
||||||
|
func loggerConfig() zap.Config {
|
||||||
|
return zap.NewDevelopmentConfig()
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
//go:build test_silent
|
||||||
|
|
||||||
|
package tt
|
||||||
|
|
||||||
|
import "go.uber.org/zap"
|
||||||
|
|
||||||
|
func loggerConfig() zap.Config {
|
||||||
|
config := zap.NewProductionConfig()
|
||||||
|
config.Level = zap.NewAtomicLevelAt(zap.WarnLevel)
|
||||||
|
return config
|
||||||
|
}
|
Loading…
Reference in New Issue