fix(pkg/daemon): write values into logfile
This commit is contained in:
@ -2,9 +2,7 @@ package daemon
|
||||
|
||||
import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/Masterminds/semver"
|
||||
"github.com/go-flucky/flucky/pkg/config"
|
||||
"github.com/go-flucky/flucky/pkg/daemon"
|
||||
"github.com/spf13/cobra"
|
||||
@ -12,13 +10,11 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
cleanCacheInterval string
|
||||
compression bool
|
||||
configFile *string
|
||||
round float64
|
||||
temperatureUnit string
|
||||
|
||||
version *semver.Version
|
||||
cachedMeasuredValues uint
|
||||
compression bool
|
||||
configFile *string
|
||||
round float64
|
||||
temperatureUnit string
|
||||
)
|
||||
|
||||
var daemonCmd = &cobra.Command{
|
||||
@ -31,24 +27,18 @@ var daemonCmd = &cobra.Command{
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
duration, err := time.ParseDuration(cleanCacheInterval)
|
||||
if err != nil {
|
||||
log.Fatalf("Can not parse clean cache interval into duration time: %v", err)
|
||||
}
|
||||
|
||||
logger := logger.NewDefaultLogger(logger.LogLevelDebug)
|
||||
daemon.SetLogger(logger)
|
||||
daemon.Start(cnf, duration, compression, round, version)
|
||||
daemon.Start(cnf, cachedMeasuredValues, compression, round)
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
func InitCmd(cmd *cobra.Command, cnfFile *string, sversion *semver.Version) {
|
||||
func InitCmd(cmd *cobra.Command, cnfFile *string) {
|
||||
configFile = cnfFile
|
||||
version = sversion
|
||||
|
||||
cmd.AddCommand(daemonCmd)
|
||||
daemonCmd.Flags().BoolVar(&compression, "compression", true, "Compress measured values")
|
||||
daemonCmd.Flags().StringVar(&cleanCacheInterval, "clean-cache-interval", "5m", "Minute intervall to clean cache and write measured values into logfile")
|
||||
daemonCmd.Flags().UintVar(&cachedMeasuredValues, "cached-values", 500, "Number of cached values before saveing into the storage endpoint")
|
||||
daemonCmd.Flags().Float64Var(&round, "round", 0.5, "Round values. The value 0 deactivates the function")
|
||||
}
|
||||
|
Reference in New Issue
Block a user