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

Verbose debug logging via the ConsolePrinter and printer package. (#404)

This:
 * adds a global -v flag for verbosity
 * refactors the "printer" package to have a DefaultPrinter and package
   functions that call it, similar to net/http's DefaultServeMux
 * adds printer tests
 * moves current users of Debugf to Printf
 * moves most users of the "log" package to use "printer"
 * demotes noticably noisy log messages to "Debugf", like "IGNORE"-
   and "NO_PURGE"-related messages
This commit is contained in:
Ed Bardsley
2018-10-08 13:10:44 -07:00
committed by Craig Peterson
parent f58acabe9f
commit 06ee4d6fb1
12 changed files with 143 additions and 55 deletions

View File

@ -78,12 +78,12 @@ func (args *PushArgs) flags() []cli.Flag {
// Preview implements the preview subcommand.
func Preview(args PreviewArgs) error {
return run(args, false, false, printer.ConsolePrinter{})
return run(args, false, false, printer.DefaultPrinter)
}
// Push implements the push subcommand.
func Push(args PushArgs) error {
return run(args.PreviewArgs, true, args.Interactive, printer.ConsolePrinter{})
return run(args.PreviewArgs, true, args.Interactive, printer.DefaultPrinter)
}
// run is the main routine common to preview/push
@ -161,7 +161,7 @@ DomainLoop:
fmt.Fprintf(os.Stderr, "##teamcity[buildStatus status='SUCCESS' text='%d corrections']", totalCorrections)
}
notifier.Done()
out.Debugf("Done. %d corrections.\n", totalCorrections)
out.Printf("Done. %d corrections.\n", totalCorrections)
if anyErrors {
return errors.Errorf("Completed with errors")
}