From e65bc868fcb1a7b59b0981f1b6827429ce4c3f6c Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Thu, 28 May 2015 21:21:44 +0200 Subject: Switch logging from glog to github.com/prometheus/log. --- node_exporter.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'node_exporter.go') diff --git a/node_exporter.go b/node_exporter.go index 7c7911a..dcd6bb4 100644 --- a/node_exporter.go +++ b/node_exporter.go @@ -13,8 +13,9 @@ import ( "syscall" "time" - "github.com/golang/glog" "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/log" + "github.com/prometheus/node_exporter/collector" ) @@ -93,10 +94,10 @@ func Execute(name string, c collector.Collector, ch chan<- prometheus.Metric) { var result string if err != nil { - glog.Infof("ERROR: %s failed after %fs: %s", name, duration.Seconds(), err) + log.Infof("ERROR: %s failed after %fs: %s", name, duration.Seconds(), err) result = "error" } else { - glog.Infof("OK: %s success after %fs.", name, duration.Seconds()) + log.Infof("OK: %s success after %fs.", name, duration.Seconds()) result = "success" } scrapeDurations.WithLabelValues(name, result).Observe(duration.Seconds()) @@ -135,12 +136,12 @@ func main() { } collectors, err := loadCollectors() if err != nil { - glog.Fatalf("Couldn't load collectors: %s", err) + log.Fatalf("Couldn't load collectors: %s", err) } - glog.Infof("Enabled collectors:") + log.Infof("Enabled collectors:") for n, _ := range collectors { - glog.Infof(" - %s", n) + log.Infof(" - %s", n) } nodeCollector := NodeCollector{collectors: collectors} @@ -152,7 +153,7 @@ func main() { handler := prometheus.Handler() if *authUser != "" || *authPass != "" { if *authUser == "" || *authPass == "" { - glog.Fatal("You need to specify -auth.user and -auth.pass to enable basic auth") + log.Fatal("You need to specify -auth.user and -auth.pass to enable basic auth") } handler = &basicAuthHandler{ handler: prometheus.Handler().ServeHTTP, @@ -172,9 +173,9 @@ func main() { `)) }) - glog.Infof("Starting node_exporter v%s at %s", Version, *listenAddress) + log.Infof("Starting node_exporter v%s at %s", Version, *listenAddress) err = http.ListenAndServe(*listenAddress, nil) if err != nil { - glog.Fatal(err) + log.Fatal(err) } } -- cgit v1.2.3