Skip to content

Commit

Permalink
feat: log out when a path is not matched to any formatter
Browse files Browse the repository at this point in the history
Signed-off-by: Brian McGee <brian@bmcgee.ie>
  • Loading branch information
brianmcgee committed May 17, 2024
1 parent 3c264c6 commit c002eca
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cli/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}()

Expand All @@ -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)
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit c002eca

Please sign in to comment.