From fea9d06ebfe2c3f4a8c80e5f63e2544a59d9a75a Mon Sep 17 00:00:00 2001 From: replay Date: Thu, 28 Jan 2021 18:28:17 -0300 Subject: [PATCH] initialize new logger for http server Signed-off-by: replay --- exporter.go | 5 +++-- go.mod | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/exporter.go b/exporter.go index 58af56c60..45cc17a09 100644 --- a/exporter.go +++ b/exporter.go @@ -17,6 +17,7 @@ import ( "golang.org/x/sys/windows/svc" "github.com/StackExchange/wmi" + gokitLog "github.com/go-kit/kit/log" "github.com/prometheus-community/windows_exporter/collector" "github.com/prometheus-community/windows_exporter/config" "github.com/prometheus/client_golang/prometheus" @@ -404,8 +405,8 @@ func main() { go func() { log.Infoln("Starting server on", *listenAddress) server := &http.Server{Addr: *listenAddress} - if err := https.Listen(server, *httpsConfig, logger); err != nil { - log.Fatalf("cannot start windows_exporter: %s", err) + if err := https.Listen(server, *httpsConfig, gokitLog.NewLogfmtLogger(os.Stdout)); err != nil { + log.Fatalf("cannot start windows_exporter: %s", err) } }() diff --git a/go.mod b/go.mod index 0bd9727b9..311d29746 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/Microsoft/hcsshim v0.8.6 github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f github.com/dimchansky/utfbom v1.1.0 + github.com/go-kit/kit v0.10.0 github.com/go-ole/go-ole v1.2.1 // indirect github.com/google/go-cmp v0.5.1 // indirect github.com/leoluk/perflib_exporter v0.1.0