all, lib/logger: Refactor SetDebug calls (#6054)

This commit is contained in:
Lukas Lihotzki
2019-10-04 13:03:34 +02:00
committed by Simon Frei
parent 8fb576ed54
commit 96bb1c8e29
27 changed files with 16 additions and 176 deletions

View File

@@ -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
}