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
|
|
@ -24,8 +24,9 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/go-kit/kit/log/level"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/common/log"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
|
|
@ -45,12 +46,14 @@ func init() {
|
|||
registerCollector("hwmon", defaultEnabled, NewHwMonCollector)
|
||||
}
|
||||
|
||||
type hwMonCollector struct{}
|
||||
type hwMonCollector struct {
|
||||
logger log.Logger
|
||||
}
|
||||
|
||||
// NewHwMonCollector returns a new Collector exposing /sys/class/hwmon stats
|
||||
// (similar to lm-sensors).
|
||||
func NewHwMonCollector() (Collector, error) {
|
||||
return &hwMonCollector{}, nil
|
||||
func NewHwMonCollector(logger log.Logger) (Collector, error) {
|
||||
return &hwMonCollector{logger}, nil
|
||||
}
|
||||
|
||||
func cleanMetricName(name string) string {
|
||||
|
|
@ -422,7 +425,7 @@ func (c *hwMonCollector) Update(ch chan<- prometheus.Metric) error {
|
|||
hwmonFiles, err := ioutil.ReadDir(hwmonPathName)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
log.Debug("hwmon collector metrics are not available for this system")
|
||||
level.Debug(c.logger).Log("msg", "hwmon collector metrics are not available for this system")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue