private/testplanet: expose NewLogger for other tests
NewLogger contains bunch of logic that is useful for creating a nice logger. Change-Id: Idad57525d334f40b3faa70dbc4737b114992b0a4
This commit is contained in:
parent
b8c55fdd87
commit
a1aa9f24ed
@ -17,7 +17,8 @@ import (
|
|||||||
|
|
||||||
var useAbsTime = os.Getenv("STORJ_TESTPLANET_ABSTIME")
|
var useAbsTime = os.Getenv("STORJ_TESTPLANET_ABSTIME")
|
||||||
|
|
||||||
func newLogger(t *testing.T) *zap.Logger {
|
// NewLogger creates a zaptest logger with nice defaults for tests.
|
||||||
|
func NewLogger(t *testing.T) *zap.Logger {
|
||||||
if useAbsTime != "" {
|
if useAbsTime != "" {
|
||||||
return zaptest.NewLogger(t)
|
return zaptest.NewLogger(t)
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ func Run(t *testing.T, config Config, test func(t *testing.T, ctx *testcontext.C
|
|||||||
planetConfig.Name = t.Name()
|
planetConfig.Name = t.Name()
|
||||||
}
|
}
|
||||||
|
|
||||||
log := newLogger(t)
|
log := NewLogger(t)
|
||||||
|
|
||||||
testmonkit.Run(context.Background(), t, func(parent context.Context) {
|
testmonkit.Run(context.Background(), t, func(parent context.Context) {
|
||||||
defer pprof.SetGoroutineLabels(parent)
|
defer pprof.SetGoroutineLabels(parent)
|
||||||
|
Loading…
Reference in New Issue
Block a user