Skip to content

Commit

Permalink
Update log variant
Browse files Browse the repository at this point in the history
Update log to 'log = logger.Log'
  • Loading branch information
TaoZou1 committed Jan 18, 2024
1 parent 43c35d9 commit 2ffaf5f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions pkg/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"sync"

"github.com/prometheus/client_golang/prometheus"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/metrics"

"github.com/vmware-tanzu/nsx-operator/pkg/config"
"github.com/vmware-tanzu/nsx-operator/pkg/logger"
)

const (
Expand All @@ -24,7 +24,7 @@ const (
ScrapeTimeout = 30
)

var log = logf.Log.WithName("metrics")
var log = logger.Log

var (
NSXOperatorHealthStats = prometheus.NewGauge(
Expand Down
5 changes: 2 additions & 3 deletions pkg/nsx/auth/jwt/JWTtokenprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ package jwt
import (
"time"

logf "sigs.k8s.io/controller-runtime/pkg/log"

"github.com/vmware-tanzu/nsx-operator/pkg/logger"
"github.com/vmware-tanzu/nsx-operator/pkg/nsx/auth"
)

Expand All @@ -18,7 +17,7 @@ const (
)

var (
log = logf.Log.WithName("nsx").WithName("jwt")
log = logger.Log
)

type JWTTokenProvider struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/nsx/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"time"

policyclient "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client"
logf "sigs.k8s.io/controller-runtime/pkg/log"

"github.com/vmware-tanzu/nsx-operator/pkg/logger"
"github.com/vmware-tanzu/nsx-operator/pkg/nsx/auth"
"github.com/vmware-tanzu/nsx-operator/pkg/nsx/ratelimiter"
"github.com/vmware-tanzu/nsx-operator/pkg/nsx/util"
Expand Down Expand Up @@ -54,7 +54,7 @@ type NsxVersion struct {
var (
jarCache = NewJar()
nsxVersion = &NsxVersion{}
log = logf.Log.WithName("nsx").WithName("cluster")
log = logger.Log
)

// NewCluster creates a cluster based on nsx Config.
Expand Down
5 changes: 3 additions & 2 deletions pkg/nsx/ratelimiter/ratelimiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import (
"time"

"golang.org/x/time/rate"
logf "sigs.k8s.io/controller-runtime/pkg/log"

"github.com/vmware-tanzu/nsx-operator/pkg/logger"
)

// APIReduceRateCodes is http status code set which will trigger rate limiter adjust.
var (
APIReduceRateCodes = [2]int{429, 503}
log = logf.Log.WithName("nsx").WithName("ratelimiter")
log = logger.Log
)

const (
Expand Down
5 changes: 3 additions & 2 deletions pkg/nsx/util/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ import (
"github.com/vmware/vsphere-automation-sdk-go/runtime/bindings"
"github.com/vmware/vsphere-automation-sdk-go/runtime/data"
"github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model"
logf "sigs.k8s.io/controller-runtime/pkg/log"

"github.com/vmware-tanzu/nsx-operator/pkg/logger"
)

var log = logf.Log.WithName("nsx").WithName("utils")
var log = logger.Log

// ErrorDetail is error detail which info extracted from http.Response.Body.
type ErrorDetail struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/util/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/sets"
"sigs.k8s.io/controller-runtime/pkg/client"
logf "sigs.k8s.io/controller-runtime/pkg/log"

"github.com/vmware-tanzu/nsx-operator/pkg/apis/v1alpha1"
"github.com/vmware-tanzu/nsx-operator/pkg/apis/v1alpha2"
"github.com/vmware-tanzu/nsx-operator/pkg/logger"
"github.com/vmware-tanzu/nsx-operator/pkg/nsx/services/common"
)

Expand Down Expand Up @@ -54,7 +54,7 @@ func init() {
}
}

var log = logf.Log.WithName("pkg").WithName("utils")
var log = logger.Log

func NormalizeLabels(matchLabels *map[string]string) *map[string]string {
newLabels := make(map[string]string)
Expand Down

0 comments on commit 2ffaf5f

Please sign in to comment.