mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
docker.go: logging of events
Add log.IsEnabledFor(logging.DEBUG) guard to avoid unnecessary memory allocations. Debug level is usually disabled. Inline "destroy"
This commit is contained in:
parent
99d9aeec98
commit
5aacdc3772
@ -2,6 +2,7 @@ package connector
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/op/go-logging"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
@ -71,10 +72,14 @@ func (cm *Docker) watchEvents() {
|
||||
|
||||
switch actionName {
|
||||
case "start", "die", "pause", "unpause", "health_status":
|
||||
log.Debugf("handling docker event: action=%s id=%s", e.Action, e.ID)
|
||||
if log.IsEnabledFor(logging.DEBUG) {
|
||||
log.Debugf("handling docker event: action=%s id=%s", e.Action, e.ID)
|
||||
}
|
||||
cm.needsRefresh <- e.ID
|
||||
case "destroy":
|
||||
log.Debugf("handling docker event: action=%s id=%s", e.Action, e.ID)
|
||||
if log.IsEnabledFor(logging.DEBUG) {
|
||||
log.Debugf("handling docker event: action=destroy id=%s", e.ID)
|
||||
}
|
||||
cm.delByID(e.ID)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user