p2p, p2p/discover, p2p/nat: rework logging using context keys

This commit is contained in:
Felix Lange
2017-02-24 09:58:04 +01:00
parent 35e8308bf7
commit 96ae35e2ac
11 changed files with 171 additions and 151 deletions

View File

@ -23,7 +23,6 @@ import (
"fmt"
"net"
"sort"
"strings"
"time"
"github.com/ethereum/go-ethereum/log"
@ -50,16 +49,10 @@ func checkClockDrift() {
return
}
if drift < -driftThreshold || drift > driftThreshold {
warning := fmt.Sprintf("System clock seems off by %v, which can prevent network connectivity", drift)
howtofix := fmt.Sprintf("Please enable network time synchronisation in system settings")
separator := strings.Repeat("-", len(warning))
log.Warn(fmt.Sprint(separator))
log.Warn(fmt.Sprint(warning))
log.Warn(fmt.Sprint(howtofix))
log.Warn(fmt.Sprint(separator))
log.Warn(fmt.Sprintf("System clock seems off by %v, which can prevent network connectivity", drift))
log.Warn("Please enable network time synchronisation in system settings.")
} else {
log.Debug(fmt.Sprintf("Sanity NTP check reported %v drift, all ok", drift))
log.Debug("NTP sanity check done", "drift", drift)
}
}