Migrate to structured logging (klog)

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-09-27 17:32:40 -03:00
parent 93ac8d5a21
commit 108637bb1c
31 changed files with 161 additions and 171 deletions

View file

@ -60,7 +60,7 @@ func setupLeaderElection(config *leaderElectionConfig) {
var stopCh chan struct{}
callbacks := leaderelection.LeaderCallbacks{
OnStartedLeading: func(ctx context.Context) {
klog.V(2).Infof("I am the new leader")
klog.V(2).InfoS("I am the new leader")
stopCh = make(chan struct{})
if config.OnStartedLeading != nil {
@ -68,7 +68,7 @@ func setupLeaderElection(config *leaderElectionConfig) {
}
},
OnStoppedLeading: func() {
klog.V(2).Info("I am not leader anymore")
klog.V(2).InfoS("I am not leader anymore")
close(stopCh)
// cancel the context
@ -81,7 +81,7 @@ func setupLeaderElection(config *leaderElectionConfig) {
}
},
OnNewLeader: func(identity string) {
klog.Infof("new leader elected: %v", identity)
klog.InfoS("New leader elected", "identity", identity)
},
}