Log failed files at error level so check -q shows them (closes #195)
check / check (push) Waiting to run

check logged each failed file at info level, and -q shows errors only,
so `check -q` reported a failure through its exit status alone. Each
failed file, and each file the manifest does not list under
--no-extra-files, is now logged at error level. A file the manifest
does not list stays a warning without --no-extra-files, and the closing
summary stays at info level.

Model: opus-5-5
This commit was merged in pull request #200.
This commit is contained in:
2026-10-13 16:46:13 +02:00
parent e633d3a31b
commit f68cc284ac
2 changed files with 35 additions and 7 deletions
+6 -6
View File
@@ -189,8 +189,8 @@ func reportCheckProgress(progress <-chan mfer.CheckStatus, wg *sync.WaitGroup) {
log.ProgressDone()
}
// countCheckFailures consumes check results, counting and logging
// failures, then closes done.
// countCheckFailures consumes check results, counting failures and logging
// each at error level so that --quiet still shows them, then closes done.
func countCheckFailures(
results <-chan mfer.Result, failures *int64, done chan<- struct{},
) {
@@ -198,7 +198,7 @@ func countCheckFailures(
if result.Status != mfer.StatusOK {
*failures++
log.Infof("%s: %s (%s)", result.Status, result.Path, result.Message)
log.Errorf("%s: %s (%s)", result.Status, result.Path, result.Message)
} else {
log.Verbosef("%s: %s", result.Status, result.Path)
}
@@ -208,8 +208,8 @@ func countCheckFailures(
}
// findExtraFiles reports files present on disk but absent from the
// manifest, and anything the search cannot read: each is a failure under
// --no-extra-files, otherwise a warning.
// manifest, and anything the search cannot read: each is a failure, logged
// at error level, under --no-extra-files, otherwise a warning.
func findExtraFiles(
ctx context.Context, cmd *cli.Command, chk *mfer.Checker, failures *int64,
) error {
@@ -221,7 +221,7 @@ func findExtraFiles(
if cmd.Bool("no-extra-files") {
*failures++
log.Infof("%s: %s (%s)", result.Status, result.Path, result.Message)
log.Errorf("%s: %s (%s)", result.Status, result.Path, result.Message)
} else {
log.Warnf("%s: %s (%s)", result.Status, result.Path, result.Message)
}