fix(pkg/logfile): use one instead of several logfiles for all measured values

This commit is contained in:
2019-06-26 23:36:01 +02:00
parent 072a902376
commit 3dae3e38be
10 changed files with 67 additions and 100 deletions

View File

@ -32,11 +32,10 @@ var rootCmd = &cobra.Command{
cnf := config.Configuration{
Device: &types.Device{
DeviceID: uuid.NewV4().String(),
DeviceName: hostname,
HumidityLogfile: "/var/log/flucky/humidity.json",
TemperatureLogfile: "/var/log/flucky/temperature.json",
CreationDate: time.Now(),
DeviceID: uuid.NewV4().String(),
DeviceName: hostname,
Logfile: "/var/log/flucky/logfile.json",
CreationDate: time.Now(),
},
}

View File

@ -23,7 +23,7 @@ var listTemperatureCmd = &cobra.Command{
log.Fatalln(err)
}
logfile := logfile.New(cnf.Device.TemperatureLogfile)
logfile := logfile.New(cnf.Device.Logfile)
measuredValues, err := logfile.Read()
if err != nil {

View File

@ -50,7 +50,7 @@ var readTemperatureCmd = &cobra.Command{
cli.PrintMeasuredValues(measuredValues, cnf, os.Stdout)
if logs {
logfile := logfile.New(cnf.Device.TemperatureLogfile)
logfile := logfile.New(cnf.Device.Logfile)
err := logfile.Append(compression, measuredValues)
if err != nil {
rgbled.Error(rgbLEDs)