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 4cbb84d commit aa6e882
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
"github.com/prometheus/client_golang/prometheus/collectors"
versioncollector "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/common/version"
"github.com/prometheus/exporter-toolkit/web"

kitlog "github.com/go-kit/log"
webflag "github.com/prometheus/exporter-toolkit/web/kingpinflag"
)

Expand All @@ -27,6 +27,9 @@ func main() {
disableExporterMetrics := kingpin.Flag("web.disable-exporter-metrics", "Exclude metrics about the exporter itself").Bool()
cmd := kingpin.Flag("command", "Path to the LVM binary").Default("/usr/sbin/lvm").String()

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

kingpin.Parse()

if *showVersion {
Expand Down Expand Up @@ -67,7 +70,7 @@ func main() {
})

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

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

0 comments on commit aa6e882

Please sign in to comment.