From 6cf04baf949595601236ee5f99f596d5c6a5f05e Mon Sep 17 00:00:00 2001 From: snaar Date: Tue, 9 Nov 2021 00:31:25 -0500 Subject: [PATCH] fix unsupported value type in debug logs due to attempting to log structs directly Signed-off-by: snaar --- collector_ipmi.go | 3 ++- freeipmi/freeipmi.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/collector_ipmi.go b/collector_ipmi.go index dfac986..c7664dc 100644 --- a/collector_ipmi.go +++ b/collector_ipmi.go @@ -14,6 +14,7 @@ package main import ( + "fmt" "math" "strconv" @@ -158,7 +159,7 @@ func (c IPMICollector) Collect(result freeipmi.Result, ch chan<- prometheus.Metr state = math.NaN() } - level.Debug(logger).Log("msg", "Got values", "data", data) + level.Debug(logger).Log("msg", "Got values", "data", fmt.Sprintf("%+v", data)) switch data.Unit { case "RPM": diff --git a/freeipmi/freeipmi.go b/freeipmi/freeipmi.go index 1473fbe..529c963 100644 --- a/freeipmi/freeipmi.go +++ b/freeipmi/freeipmi.go @@ -136,7 +136,7 @@ func Execute(cmd string, args []string, config string, target string, logger log target = "[local]" } - level.Debug(logger).Log("msg", "Executing", "command", cmd, "args", args) + level.Debug(logger).Log("msg", "Executing", "command", cmd, "args", fmt.Sprintf("%+v", args)) out, err := exec.Command(cmd, args...).CombinedOutput() if err != nil { err = fmt.Errorf("error running %s: %s", cmd, err)