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

@ -19,12 +19,12 @@ package csicommon
import (
"fmt"
"github.com/ceph/ceph-csi/internal/util/log"
"github.com/container-storage-interface/spec/lib/go/csi"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"k8s.io/klog/v2"
"github.com/ceph/ceph-csi/internal/util"
)
// CSIDriver stores driver information.
@ -91,7 +91,7 @@ func (d *CSIDriver) AddControllerServiceCapabilities(cl []csi.ControllerServiceC
csc := make([]*csi.ControllerServiceCapability, 0, len(cl))
for _, c := range cl {
util.DefaultLog("Enabling controller service capability: %v", c.String())
log.DefaultLog("Enabling controller service capability: %v", c.String())
csc = append(csc, NewControllerServiceCapability(c))
}
@ -103,7 +103,7 @@ func (d *CSIDriver) AddVolumeCapabilityAccessModes(
vc []csi.VolumeCapability_AccessMode_Mode) []*csi.VolumeCapability_AccessMode {
vca := make([]*csi.VolumeCapability_AccessMode, 0, len(vc))
for _, c := range vc {
util.DefaultLog("Enabling volume access mode: %v", c.String())
log.DefaultLog("Enabling volume access mode: %v", c.String())
vca = append(vca, NewVolumeCapabilityAccessMode(c))
}
d.vc = vca