forked from TrueCloudLab/frostfs-node
Add Inner Ring code
This commit is contained in:
parent
dadfd90dcd
commit
b7b5079934
400 changed files with 11420 additions and 8690 deletions
33
pkg/util/logger/test/logger.go
Normal file
33
pkg/util/logger/test/logger.go
Normal file
|
@ -0,0 +1,33 @@
|
|||
package test
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
||||
const sampling = 1000
|
||||
|
||||
// NewLogger creates a new logger.
|
||||
//
|
||||
// If debug, development logger is created.
|
||||
func NewLogger(debug bool) *logger.Logger {
|
||||
if debug {
|
||||
cfg := zap.NewDevelopmentConfig()
|
||||
cfg.Sampling = &zap.SamplingConfig{
|
||||
Initial: sampling,
|
||||
Thereafter: sampling,
|
||||
}
|
||||
|
||||
cfg.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
|
||||
|
||||
log, err := cfg.Build()
|
||||
if err != nil {
|
||||
panic("could not prepare logger: " + err.Error())
|
||||
}
|
||||
|
||||
return log
|
||||
}
|
||||
|
||||
return zap.L()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue