fix(pkg/logfile): use one instead of several logfiles for all measured values
This commit is contained in:
@ -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(),
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user