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

@ -2,10 +2,10 @@ package js
import (
"encoding/json"
"fmt"
"io/ioutil"
"github.com/StackExchange/dnscontrol/models"
"github.com/StackExchange/dnscontrol/pkg/printer"
"github.com/StackExchange/dnscontrol/pkg/transform"
"github.com/robertkrimen/otto"
@ -58,7 +58,7 @@ func require(call otto.FunctionCall) otto.Value {
throw(call.Otto, "require takes exactly one argument")
}
file := call.Argument(0).String()
fmt.Printf("requiring: %s\n", file)
printer.Debugf("requiring: %s\n", file)
data, err := ioutil.ReadFile(file)
if err != nil {
throw(call.Otto, err.Error())