status-go/protocol/tt/logger.go
Igor Sirotin e0eb737c51
fix_: enable tests to run with -count more than 1 (#5757)
* fix(TestProfilingCPU)_: enable run with -count=2

* fix(TestProfilingMem)_: enable run with -count=2

* fix(zaputil)_: register encoder only once

* fix(timesource)_: global variables override in tests

* fix(TestClosingsqlDB)_: delete database from cache

* fix(postgres/helpers)_: drop connections before dropping database

* fix_: linter

* chore_: remove redundant condition
2024-08-23 19:30:58 +00:00

25 lines
504 B
Go

package tt
import (
"github.com/status-im/status-go/protocol/zaputil"
"go.uber.org/zap"
)
// MustCreateTestLogger returns a logger based on the passed flags.
func MustCreateTestLogger() *zap.Logger {
return MustCreateTestLoggerWithConfig(loggerConfig())
}
func MustCreateTestLoggerWithConfig(cfg zap.Config) *zap.Logger {
if err := zaputil.RegisterConsoleHexEncoder(); err != nil {
panic(err)
}
cfg.Encoding = "console-hex"
l, err := cfg.Build()
if err != nil {
panic(err)
}
return l
}