Fixing forced logging of smartctl output irrespective of log level (now available at DEBUG level only)

TODO: add a table summary at INFO level.

fixes #123
pull/165/head
Jason Kulatunga 4 years ago
parent e5713e3a81
commit da890d95b6

@ -15,7 +15,15 @@ func ExecCmd(logger *logrus.Entry, cmdName string, cmdArgs []string, workingDir
cmd := exec.Command(cmdName, cmdArgs...) cmd := exec.Command(cmdName, cmdArgs...)
var stdBuffer bytes.Buffer var stdBuffer bytes.Buffer
mw := io.MultiWriter(logger.Logger.Out, &stdBuffer)
logWriters := []io.Writer{
&stdBuffer,
}
if logger.Logger.Level == logrus.DebugLevel {
logWriters = append(logWriters, logger.Logger.Out)
}
mw := io.MultiWriter(logWriters...)
cmd.Stdout = mw cmd.Stdout = mw
cmd.Stderr = mw cmd.Stderr = mw

Loading…
Cancel
Save