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"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/go-flucky/flucky/pkg/logfile"
|
||||||
"github.com/go-flucky/flucky/pkg/types/typeswitch"
|
"github.com/go-flucky/flucky/pkg/types/typeswitch"
|
||||||
|
|
||||||
"github.com/go-flucky/flucky/pkg/cli"
|
"github.com/go-flucky/flucky/pkg/cli"
|
||||||
@ -46,13 +47,13 @@ var readHumidityCmd = &cobra.Command{
|
|||||||
// print humidities on stdout
|
// print humidities on stdout
|
||||||
cli.PrintMeasuredValues(measuredValues, cnf, os.Stdout)
|
cli.PrintMeasuredValues(measuredValues, cnf, os.Stdout)
|
||||||
|
|
||||||
// if logs {
|
if logs {
|
||||||
// humiditiyLogfile := logfile.New(cnf.Device.HumidityLogfile)
|
logfile := logfile.New(cnf.Device.Logfile)
|
||||||
// err := logfile.AppendTemperatures(humiditiyLogfile, compression, humidities)
|
err := logfile.Append(compression, measuredValues)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,10 +50,10 @@ var readTemperatureCmd = &cobra.Command{
|
|||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
temperatures := typeswitch.TemperatureValues(measuredValues)
|
measuredValues = typeswitch.TemperatureValues(measuredValues)
|
||||||
|
|
||||||
// print temperatures on stdout
|
// print temperatures on stdout
|
||||||
cli.PrintMeasuredValues(temperatures, cnf, os.Stdout)
|
cli.PrintMeasuredValues(measuredValues, cnf, os.Stdout)
|
||||||
|
|
||||||
if logs {
|
if logs {
|
||||||
logfile := logfile.New(cnf.Device.Logfile)
|
logfile := logfile.New(cnf.Device.Logfile)
|
||||||
|
Loading…
Reference in New Issue
Block a user