Skip to content

Commit

Permalink
Switch from go-kit/log log to promslog
Browse files Browse the repository at this point in the history
  • Loading branch information
hansmi committed Oct 14, 2024
1 parent e055565 commit 71a303c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 6 additions & 3 deletions luxws-exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -46,6 +46,9 @@ func supportedLanguages() []string {
}

func main() {
promslogConfig := &promslog.Config{}
promslogflag.AddFlags(kingpin.CommandLine, promslogConfig)

kingpin.Parse()

opts := collectorOpts{
Expand Down Expand Up @@ -90,7 +93,7 @@ func main() {
</html>`))
})

logger := kitlog.NewLogfmtLogger(kitlog.StdlibWriter{})
logger := promslog.New(promslogConfig)
server := &http.Server{}

if err := web.ListenAndServe(server, webConfig, logger); err != nil {
Expand Down

0 comments on commit 71a303c

Please sign in to comment.