fix(cmd/temperatures,humidity): enable logs if flag is true and optimization of variable names
This commit is contained in:
parent
6469c0dd6c
commit
6d3781d950
@ -5,6 +5,7 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/go-flucky/flucky/pkg/logfile"
|
||||
"github.com/go-flucky/flucky/pkg/types/typeswitch"
|
||||
|
||||
"github.com/go-flucky/flucky/pkg/cli"
|
||||
@ -46,13 +47,13 @@ var readHumidityCmd = &cobra.Command{
|
||||
// print humidities on stdout
|
||||
cli.PrintMeasuredValues(measuredValues, cnf, os.Stdout)
|
||||
|
||||
// if logs {
|
||||
// humiditiyLogfile := logfile.New(cnf.Device.HumidityLogfile)
|
||||
// err := logfile.AppendTemperatures(humiditiyLogfile, compression, humidities)
|
||||
// if err != nil {
|
||||
// log.Fatalln(err)
|
||||
// }
|
||||
// }
|
||||
if logs {
|
||||
logfile := logfile.New(cnf.Device.Logfile)
|
||||
err := logfile.Append(compression, measuredValues)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -50,10 +50,10 @@ var readTemperatureCmd = &cobra.Command{
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
temperatures := typeswitch.TemperatureValues(measuredValues)
|
||||
measuredValues = typeswitch.TemperatureValues(measuredValues)
|
||||
|
||||
// print temperatures on stdout
|
||||
cli.PrintMeasuredValues(temperatures, cnf, os.Stdout)
|
||||
cli.PrintMeasuredValues(measuredValues, cnf, os.Stdout)
|
||||
|
||||
if logs {
|
||||
logfile := logfile.New(cnf.Device.Logfile)
|
||||
|
Loading…
Reference in New Issue
Block a user