mirror of
https://github.com/safing/portbase
synced 2025-09-01 10:09:50 +00:00
Improve logging control flow
This commit is contained in:
parent
70b58138b9
commit
f6f644fd8e
2 changed files with 5 additions and 2 deletions
|
@ -93,7 +93,10 @@ func log(level Severity, msg string, tracer *ContextTracer) {
|
|||
|
||||
// wake up writer if necessary
|
||||
if logsWaitingFlag.SetToIf(false, true) {
|
||||
logsWaiting <- struct{}{}
|
||||
select {
|
||||
case logsWaiting <- struct{}{}:
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ var (
|
|||
pkgLevels = make(map[string]Severity)
|
||||
pkgLevelsLock sync.Mutex
|
||||
|
||||
logsWaiting = make(chan struct{}, 4)
|
||||
logsWaiting = make(chan struct{}, 1)
|
||||
logsWaitingFlag = abool.NewBool(false)
|
||||
|
||||
shutdownFlag = abool.NewBool(false)
|
||||
|
|
Loading…
Add table
Reference in a new issue