From a1aa9f24edc28359540620174be4e95f9b1f4f1c Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Thu, 27 Jan 2022 13:56:27 +0200 Subject: [PATCH] private/testplanet: expose NewLogger for other tests NewLogger contains bunch of logic that is useful for creating a nice logger. Change-Id: Idad57525d334f40b3faa70dbc4737b114992b0a4 --- private/testplanet/log.go | 3 ++- private/testplanet/run.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/private/testplanet/log.go b/private/testplanet/log.go index 3ff099ef0..daf863ca3 100644 --- a/private/testplanet/log.go +++ b/private/testplanet/log.go @@ -17,7 +17,8 @@ import ( 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 != "" { return zaptest.NewLogger(t) } diff --git a/private/testplanet/run.go b/private/testplanet/run.go index 037ab1ab3..8885a554a 100644 --- a/private/testplanet/run.go +++ b/private/testplanet/run.go @@ -40,7 +40,7 @@ func Run(t *testing.T, config Config, test func(t *testing.T, ctx *testcontext.C planetConfig.Name = t.Name() } - log := newLogger(t) + log := NewLogger(t) testmonkit.Run(context.Background(), t, func(parent context.Context) { defer pprof.SetGoroutineLabels(parent)