Skip to content

Commit

Permalink
SetLogger for CLI and e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
sjenning committed Nov 15, 2023
1 parent 48df9ee commit 7fd51c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"syscall"

"github.com/spf13/cobra"
"go.uber.org/zap/zapcore"

"github.com/openshift/hypershift/cmd/consolelogs"
createcmd "github.com/openshift/hypershift/cmd/create"
Expand All @@ -32,9 +33,16 @@ import (
installcmd "github.com/openshift/hypershift/cmd/install"
cliversion "github.com/openshift/hypershift/cmd/version"
"github.com/openshift/hypershift/pkg/version"

ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
)

func main() {
ctrl.SetLogger(zap.New(zap.UseDevMode(true), zap.JSONEncoder(func(o *zapcore.EncoderConfig) {
o.EncodeTime = zapcore.RFC3339TimeEncoder
})))

cmd := &cobra.Command{
Use: "hypershift",
SilenceUsage: true,
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ func init() {
// TestMain deals with global options and setting up a signal-bound context
// for all tests to use.
func TestMain(m *testing.M) {
ctrl.SetLogger(log)

flag.StringVar(&globalOpts.configurableClusterOptions.AWSCredentialsFile, "e2e.aws-credentials-file", "", "path to AWS credentials")
flag.StringVar(&globalOpts.configurableClusterOptions.Region, "e2e.aws-region", "us-east-1", "AWS region for clusters")
flag.Var(&globalOpts.configurableClusterOptions.Zone, "e2e.aws-zones", "Deprecated, use -e2e.availability-zones instead")
Expand Down

0 comments on commit 7fd51c5

Please sign in to comment.