From c002eca8b775c0f49dbfd27ee164739c6e1abdd8 Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Fri, 17 May 2024 10:48:53 +0100 Subject: [PATCH] feat: log out when a path is not matched to any formatter Signed-off-by: Brian McGee --- cli/format.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cli/format.go b/cli/format.go index 0a23387e..aa72ff5c 100644 --- a/cli/format.go +++ b/cli/format.go @@ -57,12 +57,12 @@ func (f *Format) Run() (err error) { } // create a prefixed logger - l := log.WithPrefix("format") + log.SetPrefix("format") // ensure cache is closed on return defer func() { if err := cache.Close(); err != nil { - l.Errorf("failed to close cache: %v", err) + log.Errorf("failed to close cache: %v", err) } }() @@ -87,7 +87,7 @@ func (f *Format) Run() (err error) { formatterCfg := cfg.Formatters[name] formatter, err := format.NewFormatter(name, Cli.TreeRoot, formatterCfg, globalExcludes) if errors.Is(err, format.ErrCommandNotFound) && Cli.AllowMissingFormatter { - l.Debugf("formatter not found: %v", name) + log.Debugf("formatter not found: %v", name) continue } else if err != nil { return fmt.Errorf("%w: failed to initialise formatter: %v", err, name) @@ -383,6 +383,7 @@ func applyFormatters(ctx context.Context) func() error { if matched { stats.Add(stats.Matched, 1) } else { + log.Debugf("no match found: %s", file.Path) // no match, so we send it direct to the processed channel processedCh <- file }