Skip to content

Commit

Permalink
checker: Add NewLogger constructor for DetailLogger impl
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Augustus <[email protected]>
  • Loading branch information
justaugustus committed Feb 16, 2022
1 parent ba503c3 commit c80a8f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions checker/check_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
4 changes: 4 additions & 0 deletions checker/detail_logger_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ type logger struct {
logs []CheckDetail
}

func NewLogger() *logger {
return &logger{}
}

func (l *logger) Info(msg *LogMessage) {
cd := CheckDetail{
Type: DetailInfo,
Expand Down

0 comments on commit c80a8f2

Please sign in to comment.