feat(daemon): new flag to set compression

This commit is contained in:
2019-06-15 16:42:54 +02:00
parent 17e5cef737
commit 3d07cbc9ba
2 changed files with 6 additions and 5 deletions

View File

@ -15,7 +15,7 @@ import (
)
// Start the daemon
func Start(cnf *config.Configuration) error {
func Start(cnf *config.Configuration, compression bool) error {
interrupt := make(chan os.Signal, 1)
signal.Notify(interrupt, os.Interrupt, os.Kill, syscall.SIGTERM)
@ -37,7 +37,7 @@ func Start(cnf *config.Configuration) error {
log.Printf("Write measured values into logfile")
log.Printf("%v new measured temperature values", len(temperatures))
err := logfile.WriteTemperatures(temperatures, cnf.Device.TemperatureLogfile, true)
err := logfile.WriteTemperatures(temperatures, cnf.Device.TemperatureLogfile, compression)
if err != nil {
return fmt.Errorf("Can not save temperatures: %v", err)
}
@ -48,7 +48,7 @@ func Start(cnf *config.Configuration) error {
temperatures = append(temperatures, temperature)
} else {
log.Printf("Temperature Channel closed. Write remaining values into the logfile")
err := logfile.WriteTemperatures(temperatures, cnf.Device.TemperatureLogfile, true)
err := logfile.WriteTemperatures(temperatures, cnf.Device.TemperatureLogfile, compression)
if err != nil {
return fmt.Errorf("Can not save temperatures: %v", err)
}