diff --git a/cmd/manager/main.go b/cmd/manager/main.go index cafdb9f..1cf436e 100644 --- a/cmd/manager/main.go +++ b/cmd/manager/main.go @@ -22,9 +22,9 @@ func main() { logFlags := &log.Flags{} rootCmd := &cobra.Command{ Use: "manager [cmd]", - PersistentPreRunE: func(_ *cobra.Command, _ []string) error { + PersistentPreRun: func(cmd *cobra.Command, _ []string) { logFlags.ConfigureLogging() - return nil + cmd.SetContext(log.IntoContext(cmd.Context(), log.GetLogger())) }, } diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 1922afa..6cbd06d 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -22,6 +22,7 @@ import ( "testing" "time" + "github.com/cloudnative-pg/machinery/pkg/log" apimachineryTypes "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" kustomizeTypes "sigs.k8s.io/kustomize/api/types" @@ -118,7 +119,10 @@ var _ = SynchronizedBeforeSuite(func(ctx SpecContext) []byte { } return []byte{} -}, func(_ []byte) {}) +}, func(_ []byte) { + logFlags := &log.Flags{} + logFlags.ConfigureLogging() +}) // Run e2e tests using the Ginkgo runner. func TestE2E(t *testing.T) {