1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

print-ir: print validation warnings/errors to stderr (#841)

This commit is contained in:
Andreas Lutro
2020-08-31 22:01:56 +02:00
committed by GitHub
parent ff6aee9da4
commit 8e9aa14882

View File

@ -3,6 +3,7 @@ package commands
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"log"
"os" "os"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
@ -83,13 +84,13 @@ func PrintValidationErrors(errs []error) (fatal bool) {
if len(errs) == 0 { if len(errs) == 0 {
return false return false
} }
fmt.Printf("%d Validation errors:\n", len(errs)) log.Printf("%d Validation errors:\n", len(errs))
for _, err := range errs { for _, err := range errs {
if _, ok := err.(normalize.Warning); ok { if _, ok := err.(normalize.Warning); ok {
fmt.Printf("WARNING: %s\n", err) log.Printf("WARNING: %s\n", err)
} else { } else {
fatal = true fatal = true
fmt.Printf("ERROR: %s\n", err) log.Printf("ERROR: %s\n", err)
} }
} }
return return