cleanup: move log functions to new internal/util/log package

Moving the log functions into its own internal/util/log package makes it
possible to split out the humongous internal/util packages in further
smaller pieces. This reduces the inter-dependencies between utility
functions and components, preventing circular dependencies which are not
allowed in Go.

Updates: #852
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos
2021-08-24 17:03:25 +02:00
committed by mergify[bot]
parent 2036b587d7
commit 6d00b39886
41 changed files with 505 additions and 467 deletions

View File

@ -22,6 +22,8 @@ import (
"fmt"
"strings"
"github.com/ceph/ceph-csi/internal/util/log"
"github.com/container-storage-interface/spec/lib/go/csi"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@ -59,7 +61,7 @@ func GetTopologyFromDomainLabels(domainLabels, nodeName, driverName string) (map
// Convert passed in labels to a map, and check for uniqueness
labelsToRead := strings.SplitN(domainLabels, labelSeparator, -1)
DefaultLog("passed in node labels for processing: %+v", labelsToRead)
log.DefaultLog("passed in node labels for processing: %+v", labelsToRead)
labelsIn := make(map[string]bool)
labelCount := 0
@ -106,7 +108,7 @@ func GetTopologyFromDomainLabels(domainLabels, nodeName, driverName string) (map
return nil, fmt.Errorf("missing domain labels %v on node %q", missingLabels, nodeName)
}
DefaultLog("list of domains processed: %+v", domainMap)
log.DefaultLog("list of domains processed: %+v", domainMap)
topology := make(map[string]string)
for domain, value := range domainMap {