From c80a8f2324a677b4dfde5b8ce4eab094419450eb Mon Sep 17 00:00:00 2001 From: Stephen Augustus Date: Tue, 15 Feb 2022 20:16:34 -0500 Subject: [PATCH] checker: Add `NewLogger` constructor for `DetailLogger` impl Signed-off-by: Stephen Augustus --- checker/check_runner.go | 5 ++--- checker/detail_logger_impl.go | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/checker/check_runner.go b/checker/check_runner.go index 7c4e7ad3b8ab..49195dd9359b 100644 --- a/checker/check_runner.go +++ b/checker/check_runner.go @@ -79,12 +79,11 @@ func (r *Runner) Run(ctx context.Context, c Check) CheckResult { startTime := time.Now() var res CheckResult - var l logger + l := NewLogger() for retriesRemaining := checkRetries; retriesRemaining > 0; retriesRemaining-- { checkRequest := r.CheckRequest checkRequest.Ctx = ctx - l = logger{} - checkRequest.Dlogger = &l + checkRequest.Dlogger = l res = c.Fn(&checkRequest) if res.Error2 != nil && errors.Is(res.Error2, sce.ErrRepoUnreachable) { checkRequest.Dlogger.Warn(&LogMessage{ diff --git a/checker/detail_logger_impl.go b/checker/detail_logger_impl.go index 6aa1e3c18563..1eca8838dda6 100644 --- a/checker/detail_logger_impl.go +++ b/checker/detail_logger_impl.go @@ -18,6 +18,10 @@ type logger struct { logs []CheckDetail } +func NewLogger() *logger { + return &logger{} +} + func (l *logger) Info(msg *LogMessage) { cd := CheckDetail{ Type: DetailInfo,