all, lib/logger: Refactor SetDebug calls (#6054)
This commit is contained in:
committed by
Simon Frei
parent
8fb576ed54
commit
96bb1c8e29
@@ -9,7 +9,6 @@ package sync
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
deadlock "github.com/sasha-s/go-deadlock"
|
||||
@@ -23,13 +22,11 @@ var (
|
||||
// We make an exception in this package and have an actual "if debug { ...
|
||||
// }" variable, as it may be rather performance critical and does
|
||||
// nonstandard things (from a debug logging PoV).
|
||||
debug = strings.Contains(os.Getenv("STTRACE"), "sync") || os.Getenv("STTRACE") == "all"
|
||||
debug = logger.DefaultLogger.ShouldDebug("sync")
|
||||
useDeadlock = false
|
||||
)
|
||||
|
||||
func init() {
|
||||
l.SetDebug("sync", strings.Contains(os.Getenv("STTRACE"), "sync") || os.Getenv("STTRACE") == "all")
|
||||
|
||||
if n, _ := strconv.Atoi(os.Getenv("STLOCKTHRESHOLD")); n > 0 {
|
||||
threshold = time.Duration(n) * time.Millisecond
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user