From 4fb4bfeb0e5459e62b386e3f68feaf033694c771 Mon Sep 17 00:00:00 2001 From: Oscar Reyes Date: Wed, 28 Aug 2024 12:57:58 -0600 Subject: [PATCH] fixing logger bug --- cli/processor/trigger_preprocessor/graphql.go | 3 ++- cli/processor/trigger_preprocessor/grpc.go | 3 ++- cli/processor/trigger_preprocessor/http.go | 7 ++++--- cli/processor/trigger_preprocessor/playwrightengine.go | 3 ++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cli/processor/trigger_preprocessor/graphql.go b/cli/processor/trigger_preprocessor/graphql.go index a262ec8685..d51edf2d50 100644 --- a/cli/processor/trigger_preprocessor/graphql.go +++ b/cli/processor/trigger_preprocessor/graphql.go @@ -2,6 +2,7 @@ package trigger_preprocessor import ( "github.com/kubeshop/tracetest/agent/workers/trigger" + "github.com/kubeshop/tracetest/cli/cmdutil" "github.com/kubeshop/tracetest/cli/openapi" "github.com/kubeshop/tracetest/cli/pkg/fileutil" "go.uber.org/zap" @@ -12,7 +13,7 @@ type graphql struct { } func GRAPHQL(logger *zap.Logger) graphql { - return graphql{logger} + return graphql{logger: cmdutil.GetLogger()} } func (g graphql) Type() trigger.TriggerType { diff --git a/cli/processor/trigger_preprocessor/grpc.go b/cli/processor/trigger_preprocessor/grpc.go index 0760bdb4f6..b599290c18 100644 --- a/cli/processor/trigger_preprocessor/grpc.go +++ b/cli/processor/trigger_preprocessor/grpc.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/kubeshop/tracetest/agent/workers/trigger" + "github.com/kubeshop/tracetest/cli/cmdutil" "github.com/kubeshop/tracetest/cli/openapi" "github.com/kubeshop/tracetest/cli/pkg/fileutil" "go.uber.org/zap" @@ -14,7 +15,7 @@ type grpc struct { } func GRPC(logger *zap.Logger) grpc { - return grpc{logger} + return grpc{logger: cmdutil.GetLogger()} } func (g grpc) Type() trigger.TriggerType { diff --git a/cli/processor/trigger_preprocessor/http.go b/cli/processor/trigger_preprocessor/http.go index a3083a0d89..3d90ae8db6 100644 --- a/cli/processor/trigger_preprocessor/http.go +++ b/cli/processor/trigger_preprocessor/http.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/kubeshop/tracetest/agent/workers/trigger" + "github.com/kubeshop/tracetest/cli/cmdutil" "github.com/kubeshop/tracetest/cli/openapi" "github.com/kubeshop/tracetest/cli/pkg/fileutil" "go.uber.org/zap" @@ -14,7 +15,7 @@ type http struct { } func HTTP(logger *zap.Logger) http { - return http{logger} + return http{logger: cmdutil.GetLogger()} } func (g http) Type() trigger.TriggerType { @@ -30,13 +31,13 @@ func (g http) Preprocess(input fileutil.File, test openapi.TestResource) (openap } bodyFilePath := input.RelativeFile(definedBodyFile) - g.logger.Debug("protobuf file", zap.String("path", bodyFilePath)) + g.logger.Debug("http body file", zap.String("path", bodyFilePath)) bodyFile, err := fileutil.Read(definedBodyFile) if err != nil { return test, fmt.Errorf(`cannot read protobuf file: %w`, err) } - g.logger.Debug("protobuf file contents", zap.String("contents", string(bodyFile.Contents()))) + g.logger.Debug("http body file contents", zap.String("contents", string(bodyFile.Contents()))) test.Spec.Trigger.HttpRequest.SetBody(string(bodyFile.Contents())) diff --git a/cli/processor/trigger_preprocessor/playwrightengine.go b/cli/processor/trigger_preprocessor/playwrightengine.go index b32f1cb68b..c22d69a8c8 100644 --- a/cli/processor/trigger_preprocessor/playwrightengine.go +++ b/cli/processor/trigger_preprocessor/playwrightengine.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/kubeshop/tracetest/agent/workers/trigger" + "github.com/kubeshop/tracetest/cli/cmdutil" "github.com/kubeshop/tracetest/cli/openapi" "github.com/kubeshop/tracetest/cli/pkg/fileutil" "go.uber.org/zap" @@ -14,7 +15,7 @@ type playwrightengine struct { } func PLAYWRIGHTENGINE(logger *zap.Logger) playwrightengine { - return playwrightengine{logger} + return playwrightengine{logger: cmdutil.GetLogger()} } func (g playwrightengine) Type() trigger.TriggerType {