diff options
Diffstat (limited to 'utils_housekeep.go')
-rw-r--r-- | utils_housekeep.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/utils_housekeep.go b/utils_housekeep.go index 670a95b..d34292f 100644 --- a/utils_housekeep.go +++ b/utils_housekeep.go @@ -3,7 +3,6 @@ package main import ( "context" "fmt" - logger "log" "os" "os/signal" "syscall" @@ -39,7 +38,7 @@ func (m *metrics) update(other metrics) { m.avg = float64(m.NumEntries) / float64((other.Timestamp - m.Timestamp)) } -func handleMetrics(ctx context.Context, metricsCh chan metrics, logs []metadata.Log) { +func handleMetrics(ctx context.Context, opts options, logs []metadata.Log, metricsCh chan metrics) { sum := make(map[string]metrics) for _, log := range logs { sum[*log.Description] = metrics{ @@ -48,7 +47,7 @@ func handleMetrics(ctx context.Context, metricsCh chan metrics, logs []metadata. } } - ticker := time.NewTicker(15 * time.Second) + ticker := time.NewTicker(opts.MetricsInterval) defer ticker.Stop() for { select { @@ -62,7 +61,7 @@ func handleMetrics(ctx context.Context, metricsCh chan metrics, logs []metadata. for _, log := range logs { output += sum[*log.Description].String() } - logger.Printf("INFO: periodic status update\n\n%s\n\n", output) + fmt.Fprintf(os.Stderr, "INFO: periodic status update\n\n%s\n\n", output) } } } |