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

@ -23,6 +23,8 @@ import (
"strings"
"sync"
"github.com/ceph/ceph-csi/internal/util/log"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/csi-addons/spec/lib/go/replication"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
@ -30,8 +32,6 @@ import (
"github.com/prometheus/client_golang/prometheus"
"google.golang.org/grpc"
"k8s.io/klog/v2"
"github.com/ceph/ceph-csi/internal/util"
)
// NonBlockingGRPCServer defines Non blocking GRPC server interfaces.
@ -128,7 +128,7 @@ func (s *nonBlockingGRPCServer) serve(endpoint, hstOptions string, srv Servers,
replication.RegisterControllerServer(server, srv.RS)
}
util.DefaultLog("Listening for connections on address: %#v", listener.Addr())
log.DefaultLog("Listening for connections on address: %#v", listener.Addr())
if metrics {
ho := strings.Split(hstOptions, ",")
const expectedHo = 3