From 10ddc4e9c56beeb5718cd878313ddf88695a1948 Mon Sep 17 00:00:00 2001 From: Will Hawkins Date: Wed, 4 May 2022 17:51:50 -0400 Subject: Make Traceable Interface and Refactor Debugging 1. Make a traceable interface for all things that can be wrapped in an httptrace.ClientTrace. 2. Refactor debugging system into debug package. --- timeoutat/timeoutat.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'timeoutat') diff --git a/timeoutat/timeoutat.go b/timeoutat/timeoutat.go index eac57f2..673ca38 100644 --- a/timeoutat/timeoutat.go +++ b/timeoutat/timeoutat.go @@ -19,19 +19,18 @@ import ( "fmt" "time" - "github.com/network-quality/goresponsiveness/constants" - "github.com/network-quality/goresponsiveness/utilities" + "github.com/network-quality/goresponsiveness/debug" ) func TimeoutAt( ctx context.Context, when time.Time, - debug constants.DebugLevel, + debugLevel debug.DebugLevel, ) (response chan interface{}) { response = make(chan interface{}) go func(ctx context.Context) { go func() { - if utilities.IsDebug(debug) { + if debug.IsDebug(debugLevel) { fmt.Printf("Timeout expected to end at %v\n", when) } select { @@ -39,7 +38,7 @@ func TimeoutAt( case <-ctx.Done(): } response <- struct{}{} - if utilities.IsDebug(debug) { + if debug.IsDebug(debugLevel) { fmt.Printf("Timeout ended at %v\n", time.Now()) } }() -- cgit v1.2.3