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

@@ -3,7 +3,6 @@ package namecheap
import (
"encoding/json"
"fmt"
"log"
"sort"
"strings"
"time"
@@ -11,6 +10,7 @@ import (
"golang.org/x/net/publicsuffix"
"github.com/StackExchange/dnscontrol/models"
"github.com/StackExchange/dnscontrol/pkg/printer"
"github.com/StackExchange/dnscontrol/providers"
"github.com/StackExchange/dnscontrol/providers/diff"
nc "github.com/billputer/go-namecheap"
@@ -98,7 +98,7 @@ func doWithRetry(f func() error) {
if currentRetry >= maxRetries {
return
}
log.Printf("Namecheap rate limit exceeded. Waiting %s to retry.", sleepTime)
printer.Printf("Namecheap rate limit exceeded. Waiting %s to retry.\n", sleepTime)
time.Sleep(sleepTime)
} else {
return