From c28d2b3a66cbd468f567ed0b4ddce3157169707d Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Fri, 12 Aug 2016 15:31:44 -0400 Subject: [PATCH] namespace: add debug output Signed-off-by: Vincent Batts --- worker/detectors/namespace.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/worker/detectors/namespace.go b/worker/detectors/namespace.go index 7d00cdfc..e77ef23d 100644 --- a/worker/detectors/namespace.go +++ b/worker/detectors/namespace.go @@ -21,6 +21,7 @@ import ( "sync" "github.com/coreos/clair/database" + "github.com/coreos/pkg/capnslog" ) // The NamespaceDetector interface defines a way to detect a Namespace from input data. @@ -34,6 +35,8 @@ type NamespaceDetector interface { } var ( + nlog = capnslog.NewPackageLogger("github.com/coreos/clair", "worker/detectors") + namespaceDetectorsLock sync.Mutex 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. func DetectNamespace(data map[string][]byte) *database.Namespace { - for _, detector := range namespaceDetectors { + for name, detector := range namespaceDetectors { if namespace := detector.Detect(data); namespace != nil { + nlog.Debugf("detector: %q; namespace: %q\n", name, namespace.Name) return namespace } }