mirror of
https://github.com/safing/portbase
synced 2025-09-04 11:40:23 +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
|
// wake up writer if necessary
|
||||||
if logsWaitingFlag.SetToIf(false, true) {
|
if logsWaitingFlag.SetToIf(false, true) {
|
||||||
logsWaiting <- struct{}{}
|
select {
|
||||||
|
case logsWaiting <- struct{}{}:
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ var (
|
||||||
pkgLevels = make(map[string]Severity)
|
pkgLevels = make(map[string]Severity)
|
||||||
pkgLevelsLock sync.Mutex
|
pkgLevelsLock sync.Mutex
|
||||||
|
|
||||||
logsWaiting = make(chan struct{}, 4)
|
logsWaiting = make(chan struct{}, 1)
|
||||||
logsWaitingFlag = abool.NewBool(false)
|
logsWaitingFlag = abool.NewBool(false)
|
||||||
|
|
||||||
shutdownFlag = abool.NewBool(false)
|
shutdownFlag = abool.NewBool(false)
|
||||||
|
|
Loading…
Add table
Reference in a new issue