Skip to content

Commit

Permalink
Revert logging format changes
Browse files Browse the repository at this point in the history
Signed-off-by: Katrina Ronquillo <katrina.ronq@gmail.com>
  • Loading branch information
tammy-young authored and katronquillo committed Jul 2, 2024
1 parent a5ec521 commit b0723c5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
10 changes: 4 additions & 6 deletions cmd/provider/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func main() {
)
kingpin.MustParse(app.Parse(os.Args[1:]))

zl := zap.New(zap.UseDevMode(*debug), UseJSONencoder())
zl := zap.New(zap.UseDevMode(*debug), UseISO8601())
log := logging.NewLogrLogger(zl.WithName("provider-terraform"))
if *debug {
// The controller-runtime runs with a no-op logger by default. It is
Expand Down Expand Up @@ -150,11 +150,9 @@ func main() {
kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager")
}

// UseJSONencoder sets the logger to use json format for log records
func UseJSONencoder() zap.Opts {
// UseISO8601 sets the logger to use ISO8601 timestamp format
func UseISO8601() zap.Opts {
return func(o *zap.Options) {
encoderConfig := zapuber.NewProductionEncoderConfig()
encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
o.Encoder = zapcore.NewJSONEncoder(encoderConfig)
o.TimeEncoder = zapcore.ISO8601TimeEncoder
}
}
2 changes: 1 addition & 1 deletion internal/controller/workspace/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ func (c *connector) Connect(ctx context.Context, mg resource.Managed) (managed.E
}
envs[idx] = strings.Join([]string{env.Name, runtimeVal}, "=")
}

tf := c.terraform(dir, *pc.Spec.PluginCache, cr.Spec.ForProvider.EnableTerraformCLILogging, l, envs...)
if cr.Status.AtProvider.Checksum != "" {
checksum, err := tf.GenerateChecksum(ctx)
Expand Down
3 changes: 2 additions & 1 deletion internal/terraform/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ import (
"sort"
"strconv"
"strings"
"sync"
"syscall"

"sync"

"github.com/crossplane/crossplane-runtime/pkg/logging"
"github.com/pkg/errors"
)
Expand Down

0 comments on commit b0723c5

Please sign in to comment.