From f7ff644a92c586e60c8515b3ec0c3101df76925a Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 23 Dec 2021 11:10:13 +0800 Subject: [PATCH] change: add warn logs --- internal/boomer/boomer.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/boomer/boomer.go b/internal/boomer/boomer.go index dc824dc2..3f50a60b 100644 --- a/internal/boomer/boomer.go +++ b/internal/boomer/boomer.go @@ -97,6 +97,7 @@ func (b *Boomer) Run(tasks ...*Task) { // RecordTransaction reports a transaction stat. func (b *Boomer) RecordTransaction(name string, success bool, elapsedTime int64, contentSize int64) { if b.localRunner == nil { + log.Warn().Msg("boomer not initialized") return } b.localRunner.stats.transactionChan <- &transaction{ @@ -110,6 +111,7 @@ func (b *Boomer) RecordTransaction(name string, success bool, elapsedTime int64, // RecordSuccess reports a success. func (b *Boomer) RecordSuccess(requestType, name string, responseTime int64, responseLength int64) { if b.localRunner == nil { + log.Warn().Msg("boomer not initialized") return } b.localRunner.stats.requestSuccessChan <- &requestSuccess{ @@ -123,6 +125,7 @@ func (b *Boomer) RecordSuccess(requestType, name string, responseTime int64, res // RecordFailure reports a failure. func (b *Boomer) RecordFailure(requestType, name string, responseTime int64, exception string) { if b.localRunner == nil { + log.Warn().Msg("boomer not initialized") return } b.localRunner.stats.requestFailureChan <- &requestFailure{ @@ -135,5 +138,9 @@ func (b *Boomer) RecordFailure(requestType, name string, responseTime int64, exc // Quit will send a quit message to the master. func (b *Boomer) Quit() { + if b.localRunner == nil { + log.Warn().Msg("boomer not initialized") + return + } b.localRunner.close() }