From 2805655ab04603446a5422905d32cb953b560556 Mon Sep 17 00:00:00 2001 From: ChrisJr404 Date: Tue, 14 Jul 2026 08:49:53 -0400 Subject: [PATCH] feat(cmd): log total scan duration at info level (#4858) Closes #4587 Adds a single info-level log line at the end of every `syft scan` run that reports the total scan wall-clock time, e.g.: [0003] INFO scan completed in 2.017s Per maintainer guidance on the issue, the line is logged at INFO so it surfaces with `-v` (alongside the existing per-cataloger timing) and stays out of the default TUI / stdout. Useful for users who leave long scans running and want the overall time at a glance, without having to wrap the invocation in `time`. Signed-off-by: Chris (ChrisJr404) <11917633+ChrisJr404@users.noreply.github.com> Co-authored-by: Chris (ChrisJr404) <11917633+ChrisJr404@users.noreply.github.com> --- cmd/syft/internal/commands/scan.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/syft/internal/commands/scan.go b/cmd/syft/internal/commands/scan.go index d9147dace..7db17fb7d 100644 --- a/cmd/syft/internal/commands/scan.go +++ b/cmd/syft/internal/commands/scan.go @@ -7,6 +7,7 @@ import ( "os" "reflect" "strings" + "time" "github.com/hashicorp/go-multierror" "github.com/spf13/cobra" @@ -171,6 +172,11 @@ func validateArgs(cmd *cobra.Command, args []string, err string) error { } func runScan(ctx context.Context, id clio.Identification, opts *scanOptions, userInput string) error { + scanStart := time.Now() + defer func() { + log.Infof("scan completed in %s", time.Since(scanStart).Round(time.Millisecond)) + }() + writer, err := opts.SBOMWriter() if err != nil { return err