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
|
|
@ -20,7 +20,8 @@ import (
|
|||
"regexp"
|
||||
"strconv"
|
||||
|
||||
"github.com/prometheus/common/log"
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/go-kit/kit/log/level"
|
||||
)
|
||||
|
||||
/*
|
||||
|
|
@ -31,7 +32,7 @@ import (
|
|||
*/
|
||||
import "C"
|
||||
|
||||
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{}
|
||||
|
||||
var ifap, ifa *C.struct_ifaddrs
|
||||
|
|
@ -44,11 +45,11 @@ func getNetDevStats(ignore *regexp.Regexp, accept *regexp.Regexp) (map[string]ma
|
|||
if ifa.ifa_addr.sa_family == C.AF_LINK {
|
||||
dev := C.GoString(ifa.ifa_name)
|
||||
if ignore != nil && ignore.MatchString(dev) {
|
||||
log.Debugf("Ignoring device: %s", dev)
|
||||
level.Debug(logger).Log("msg", "Ignoring device", "device", dev)
|
||||
continue
|
||||
}
|
||||
if accept != nil && !accept.MatchString(dev) {
|
||||
log.Debugf("Ignoring device: %s", dev)
|
||||
level.Debug(logger).Log("msg", "Ignoring device", "device", dev)
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue