Skip to content

Commit

Permalink
fixing logger bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xoscar committed Aug 28, 2024
1 parent d1d3fe5 commit 4fb4bfe
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion cli/processor/trigger_preprocessor/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion cli/processor/trigger_preprocessor/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand Down
7 changes: 4 additions & 3 deletions cli/processor/trigger_preprocessor/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand All @@ -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()))

Expand Down
3 changes: 2 additions & 1 deletion cli/processor/trigger_preprocessor/playwrightengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand Down

0 comments on commit 4fb4bfe

Please sign in to comment.