fix unsupported value type in debug logs due to attempting to log structs directly

Signed-off-by: snaar <snaar@snaar.net>
This commit is contained in:
snaar 2021-11-09 00:31:25 -05:00
parent b806738818
commit 6cf04baf94
2 changed files with 3 additions and 2 deletions

View File

@ -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":

View File

@ -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)