From f530265f3063d557fd3684d5d8fee0debff854fd Mon Sep 17 00:00:00 2001 From: Michael Hanselmann Date: Mon, 14 Oct 2024 17:53:34 +0200 Subject: [PATCH] Switch from go-kit/log log to promslog --- go.mod | 5 +++-- luxws-exporter/main.go | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 8f8acfe..4ddd4fb 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,8 @@ module github.com/hansmi/wp2reg-luxws -go 1.21 -toolchain go1.22.5 +go 1.22 + +toolchain go1.22.7 require ( github.com/alecthomas/kingpin/v2 v2.4.0 diff --git a/luxws-exporter/main.go b/luxws-exporter/main.go index 7a1e70f..e456734 100644 --- a/luxws-exporter/main.go +++ b/luxws-exporter/main.go @@ -12,9 +12,9 @@ import ( "github.com/prometheus/client_golang/prometheus/collectors" "github.com/prometheus/client_golang/prometheus/collectors/version" "github.com/prometheus/client_golang/prometheus/promhttp" + "github.com/prometheus/common/promslog" + promslogflag "github.com/prometheus/common/promslog/flag" "github.com/prometheus/exporter-toolkit/web" - - kitlog "github.com/go-kit/log" webflag "github.com/prometheus/exporter-toolkit/web/kingpinflag" ) @@ -46,6 +46,9 @@ func supportedLanguages() []string { } func main() { + promslogConfig := &promslog.Config{} + promslogflag.AddFlags(kingpin.CommandLine, promslogConfig) + kingpin.Parse() opts := collectorOpts{ @@ -90,7 +93,7 @@ func main() { `)) }) - logger := kitlog.NewLogfmtLogger(kitlog.StdlibWriter{}) + logger := promslog.New(promslogConfig) server := &http.Server{} if err := web.ListenAndServe(server, webConfig, logger); err != nil {