namespace: add debug output
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
4bc6416132
commit
c28d2b3a66
@ -21,6 +21,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/coreos/clair/database"
|
"github.com/coreos/clair/database"
|
||||||
|
"github.com/coreos/pkg/capnslog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The NamespaceDetector interface defines a way to detect a Namespace from input data.
|
// The NamespaceDetector interface defines a way to detect a Namespace from input data.
|
||||||
@ -34,6 +35,8 @@ type NamespaceDetector interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
nlog = capnslog.NewPackageLogger("github.com/coreos/clair", "worker/detectors")
|
||||||
|
|
||||||
namespaceDetectorsLock sync.Mutex
|
namespaceDetectorsLock sync.Mutex
|
||||||
namespaceDetectors = make(map[string]NamespaceDetector)
|
namespaceDetectors = make(map[string]NamespaceDetector)
|
||||||
)
|
)
|
||||||
@ -62,8 +65,9 @@ func RegisterNamespaceDetector(name string, f NamespaceDetector) {
|
|||||||
|
|
||||||
// DetectNamespace finds the OS of the layer by using every registered NamespaceDetector.
|
// DetectNamespace finds the OS of the layer by using every registered NamespaceDetector.
|
||||||
func DetectNamespace(data map[string][]byte) *database.Namespace {
|
func DetectNamespace(data map[string][]byte) *database.Namespace {
|
||||||
for _, detector := range namespaceDetectors {
|
for name, detector := range namespaceDetectors {
|
||||||
if namespace := detector.Detect(data); namespace != nil {
|
if namespace := detector.Detect(data); namespace != nil {
|
||||||
|
nlog.Debugf("detector: %q; namespace: %q\n", name, namespace.Name)
|
||||||
return namespace
|
return namespace
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user