switch to go-kit/log (#1575)
Signed-off-by: yeya24 <yb532204897@gmail.com>
This commit is contained in:
parent
a80b7d0bc5
commit
2477c5c67d
158 changed files with 3434 additions and 4636 deletions
|
|
@ -23,11 +23,12 @@ import (
|
|||
"regexp"
|
||||
"strconv"
|
||||
|
||||
"github.com/prometheus/common/log"
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/go-kit/kit/log/level"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func getNetDevStats(ignore *regexp.Regexp, accept *regexp.Regexp) (map[string]map[string]string, error) {
|
||||
func getNetDevStats(ignore *regexp.Regexp, accept *regexp.Regexp, logger log.Logger) (map[string]map[string]string, error) {
|
||||
netDev := map[string]map[string]string{}
|
||||
|
||||
ifs, err := net.Interfaces()
|
||||
|
|
@ -38,16 +39,16 @@ func getNetDevStats(ignore *regexp.Regexp, accept *regexp.Regexp) (map[string]ma
|
|||
for _, iface := range ifs {
|
||||
ifaceData, err := getIfaceData(iface.Index)
|
||||
if err != nil {
|
||||
log.Debugf("failed to load data for interface %q: %v", iface.Name, err)
|
||||
level.Debug(logger).Log("msg", "failed to load data for interface", "device", iface.Name, "err", err)
|
||||
continue
|
||||
}
|
||||
|
||||
if ignore != nil && ignore.MatchString(iface.Name) {
|
||||
log.Debugf("Ignoring device: %s", iface.Name)
|
||||
level.Debug(logger).Log("msg", "Ignoring device", "device", iface.Name)
|
||||
continue
|
||||
}
|
||||
if accept != nil && !accept.MatchString(iface.Name) {
|
||||
log.Debugf("Ignoring device: %s", iface.Name)
|
||||
level.Debug(logger).Log("msg", "Ignoring device", "device", iface.Name)
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue