fix: add log time of task (#3105)

Signed-off-by: tomersein <tomersein@gmail.com>
This commit is contained in:
GGMU 2024-08-28 18:04:26 +03:00 committed by GitHub
parent 5ab43bafec
commit 04e3371cce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,7 +5,9 @@ import (
"fmt"
"runtime/debug"
"sync"
"time"
"github.com/anchore/syft/internal/log"
"github.com/hashicorp/go-multierror"
"github.com/anchore/syft/internal/sbomsync"
@ -68,5 +70,8 @@ func runTaskSafely(ctx context.Context, t Task, resolver file.Resolver, s sbomsy
}
}()
return t.Execute(ctx, resolver, s)
start := time.Now()
res := t.Execute(ctx, resolver, s)
log.WithFields("task", t.Name(), "elapsed", time.Since(start)).Info("task completed")
return res
}