fix(logfile): Add pkg to operate with logfiles

This commit is contained in:
2019-06-13 23:21:41 +02:00
parent a8aa7a14c5
commit 5666830030
4 changed files with 127 additions and 8 deletions

View File

@ -8,6 +8,7 @@ import (
"github.com/spf13/cobra"
"github.com/volker-raschek/flucky/pkg/cli"
"github.com/volker-raschek/flucky/pkg/config"
"github.com/volker-raschek/flucky/pkg/logfile"
"github.com/volker-raschek/flucky/pkg/sensor"
)
@ -36,6 +37,13 @@ var readTemperatureCmd = &cobra.Command{
// print temperatures on stdout
cli.PrintTemperatures(temperatures, cnf, os.Stdout)
if logs {
err := logfile.WriteTemperatures(cnf.Device.TemperatureLogfile, temperatures)
if err != nil {
log.Fatalln(err)
}
}
},
}