Call slog directly instead of using a wrapper

Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
pull/30616/head
Benoit Tigeot 2 years ago committed by Andrea Tartaglia
parent 77298e5abf
commit 99dd65a739
No known key found for this signature in database

@ -473,6 +473,8 @@ func (cfg *Configuration) Init(getter genericclioptions.RESTClientGetter, namesp
clientFn: kc.Factory.KubernetesClientSet, clientFn: kc.Factory.KubernetesClientSet,
} }
// slog.SetDefault()
var store *storage.Storage var store *storage.Storage
switch helmDriver { switch helmDriver {
case "secret", "secrets", "": case "secret", "secrets", "":

@ -19,7 +19,6 @@ package cmd
import ( import (
"bytes" "bytes"
"io" "io"
"log/slog"
"os" "os"
"strings" "strings"
"testing" "testing"

@ -21,7 +21,6 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"log/slog"
"net/http" "net/http"
"strings" "strings"
"sync" "sync"

@ -17,8 +17,6 @@ package kube // import "helm.sh/helm/v4/pkg/kube"
import ( import (
"context" "context"
"io"
"log/slog"
"testing" "testing"
appsv1 "k8s.io/api/apps/v1" appsv1 "k8s.io/api/apps/v1"

@ -18,8 +18,6 @@ package kube // import "helm.sh/helm/v3/pkg/kube"
import ( import (
"errors" "errors"
"io"
"log/slog"
"testing" "testing"
"time" "time"

@ -153,7 +153,7 @@ func (hw *legacyWaiter) WaitForDelete(deleted ResourceList, timeout time.Duratio
if err != nil { if err != nil {
hw.log.Debug("wait for resources failed", "elapsed", elapsed, "error", err) hw.log.Debug("wait for resources failed", "elapsed", elapsed, "error", err)
} else { } else {
hw.log.Debug("wait for resources succeeded", "elapsed", elapsed) slog.Debug("wait for resources succeeded", "elapsed", elapsed)
} }
return err return err
@ -397,7 +397,7 @@ func (hw *legacyWaiter) watchUntilReady(timeout time.Duration, info *resource.In
return nil return nil
} }
hw.log.Debug("watching for resource changes", "kind", kind, "resource", info.Name, "timeout", timeout) slog.Debug("watching for resource changes", "kind", kind, "resource", info.Name, "timeout", timeout)
// Use a selector on the name of the resource. This should be unique for the // Use a selector on the name of the resource. This should be unique for the
// given version and kind // given version and kind
@ -425,7 +425,7 @@ func (hw *legacyWaiter) watchUntilReady(timeout time.Duration, info *resource.In
// we get. We care mostly about jobs, where what we want to see is // we get. We care mostly about jobs, where what we want to see is
// the status go into a good state. For other types, like ReplicaSet // the status go into a good state. For other types, like ReplicaSet
// we don't really do anything to support these as hooks. // we don't really do anything to support these as hooks.
hw.log.Debug("add/modify event received", "resource", info.Name, "eventType", e.Type) slog.Debug("add/modify event received", "resource", info.Name, "eventType", e.Type)
switch kind { switch kind {
case "Job": case "Job":
@ -435,11 +435,11 @@ func (hw *legacyWaiter) watchUntilReady(timeout time.Duration, info *resource.In
} }
return true, nil return true, nil
case watch.Deleted: case watch.Deleted:
hw.log.Debug("deleted event received", "resource", info.Name) slog.Debug("deleted event received", "resource", info.Name)
return true, nil return true, nil
case watch.Error: case watch.Error:
// Handle error and return with an error. // Handle error and return with an error.
hw.log.Error("error event received", "resource", info.Name) slog.Error("error event received", "resource", info.Name)
return true, errors.Errorf("failed to deploy %s", info.Name) return true, errors.Errorf("failed to deploy %s", info.Name)
default: default:
return false, nil return false, nil
@ -465,7 +465,7 @@ func (hw *HelmWaiter) waitForJob(obj runtime.Object, name string) (bool, error)
} }
} }
hw.log.Debug("job status update", "job", name, "active", o.Status.Active, "failed", o.Status.Failed, "succeeded", o.Status.Succeeded) slog.Debug("job status update", "job", name, "active", o.Status.Active, "failed", o.Status.Failed, "succeeded", o.Status.Succeeded)
return false, nil return false, nil
} }

@ -19,8 +19,6 @@ package driver // import "helm.sh/helm/v4/pkg/storage/driver"
import ( import (
"context" "context"
"fmt" "fmt"
"io"
"log/slog"
"testing" "testing"
sqlmock "github.com/DATA-DOG/go-sqlmock" sqlmock "github.com/DATA-DOG/go-sqlmock"

Loading…
Cancel
Save