Merge pull request #88 from snaar/master

fix unsupported value type in debug logs due to attempting to log structs directly
This commit is contained in:
Conrad Hoffmann 2021-12-10 19:55:05 +01:00 committed by GitHub
commit e596edb616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)