Skip to content

Commit

Permalink
namespace: add debug output
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
  • Loading branch information
vbatts committed Aug 12, 2016
1 parent 4bc6416 commit c28d2b3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion worker/detectors/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
)
Expand Down Expand Up @@ -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
}
}
Expand Down

0 comments on commit c28d2b3

Please sign in to comment.