Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Unified Diff: common/meter/meter.go

Issue 1622553005: Remove log filtering and add stringsetflag. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: error on empty Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « common/logging/gologger/logger.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common/meter/meter.go
diff --git a/common/meter/meter.go b/common/meter/meter.go
index 4a0afd8b22cd729b459b0d94d427911212c0281c..cc0da8a676e69dcff4c4297a4ab05838b1175d71 100644
--- a/common/meter/meter.go
+++ b/common/meter/meter.go
@@ -120,10 +120,8 @@ func (m *meter) consumeWork() {
// Acknowledge when this goroutine finishes.
defer close(m.closeAckC)
- ctx := log.SetFilter(m.ctx, "meter")
-
timerRunning := false
- flushTimer := clock.NewTimer(ctx)
+ flushTimer := clock.NewTimer(m.ctx)
defer func() {
flushTimer.Stop()
}()
@@ -139,7 +137,7 @@ func (m *meter) consumeWork() {
}
bufferedWork := make([]interface{}, 0, workBufferSize)
- log.Debugf(ctx, "Starting work loop.")
+ log.Debugf(m.ctx, "Starting work loop.")
active := true
for active {
flushRound := false
@@ -147,7 +145,7 @@ func (m *meter) consumeWork() {
select {
case work, ok := <-m.workC:
if !ok {
- log.Debugf(ctx, "Received instance close signal; terminating.")
+ log.Debugf(m.ctx, "Received instance close signal; terminating.")
// Don't immediately exit the loop, since there may still be buffered
// Work to flush.
@@ -169,7 +167,7 @@ func (m *meter) consumeWork() {
// doing this if we're not already flushing, since flushing will clear the
// timer.
if !flushRound && flushTime > 0 && !timerRunning {
- log.Infof(log.SetFields(ctx, log.Fields{
+ log.Infof(log.SetFields(m.ctx, log.Fields{
"flushInterval": flushTime,
}), "Starting flush timer.")
flushTimer.Reset(flushTime)
@@ -185,7 +183,7 @@ func (m *meter) consumeWork() {
flushRound = true
case <-flushTimer.GetC():
- log.Infof(ctx, "Flush timer has triggered.")
+ log.Infof(m.ctx, "Flush timer has triggered.")
timerRunning = false
flushRound = true
}
« no previous file with comments | « common/logging/gologger/logger.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698