2020-07-10 14:17:51 +00:00
|
|
|
package test
|
|
|
|
|
|
|
|
import (
|
2023-03-28 14:16:03 +00:00
|
|
|
"testing"
|
|
|
|
|
2023-03-07 13:38:26 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
2023-03-28 14:16:03 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
2020-07-10 14:17:51 +00:00
|
|
|
"go.uber.org/zap"
|
|
|
|
"go.uber.org/zap/zapcore"
|
|
|
|
)
|
|
|
|
|
2020-07-24 13:54:03 +00:00
|
|
|
// NewLogger creates a new logger.
|
2024-01-09 08:37:41 +00:00
|
|
|
func NewLogger(t testing.TB) *logger.Logger {
|
|
|
|
cfg := zap.NewDevelopmentConfig()
|
|
|
|
cfg.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
|
2022-09-28 07:41:01 +00:00
|
|
|
|
2024-01-09 08:37:41 +00:00
|
|
|
log, err := cfg.Build()
|
|
|
|
require.NoError(t, err, "could not prepare logger")
|
2020-07-10 14:17:51 +00:00
|
|
|
|
2024-01-09 08:37:41 +00:00
|
|
|
var l logger.Logger
|
|
|
|
l.Logger = log
|
2020-07-10 14:17:51 +00:00
|
|
|
|
2022-09-28 07:41:01 +00:00
|
|
|
return &l
|
2020-07-10 14:17:51 +00:00
|
|
|
}
|