From 19feac3a7897f2812e424c828b4875bff0aa572a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Jul 2022 17:58:56 +0000 Subject: [PATCH 1/3] Bump github.com/hashicorp/terraform-plugin-log from 0.4.1 to 0.6.0 Bumps [github.com/hashicorp/terraform-plugin-log](https://github.com/hashicorp/terraform-plugin-log) from 0.4.1 to 0.6.0. - [Release notes](https://github.com/hashicorp/terraform-plugin-log/releases) - [Changelog](https://github.com/hashicorp/terraform-plugin-log/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashicorp/terraform-plugin-log/compare/v0.4.1...v0.6.0) --- updated-dependencies: - dependency-name: github.com/hashicorp/terraform-plugin-log dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0d6a5300..9c5ccf8b 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/hashicorp/go-hclog v1.2.1 github.com/hashicorp/go-plugin v1.4.4 github.com/hashicorp/go-uuid v1.0.3 - github.com/hashicorp/terraform-plugin-log v0.4.1 + github.com/hashicorp/terraform-plugin-log v0.6.0 github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c github.com/mitchellh/go-testing-interface v1.14.1 github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce diff --git a/go.sum b/go.sum index 293b46ca..c35a0b50 100644 --- a/go.sum +++ b/go.sum @@ -64,8 +64,8 @@ github.com/hashicorp/go-plugin v1.4.4/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHG github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/terraform-plugin-log v0.4.1 h1:xpbmVhvuU3mgHzLetOmx9pkOL2rmgpu302XxddON6eo= -github.com/hashicorp/terraform-plugin-log v0.4.1/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4= +github.com/hashicorp/terraform-plugin-log v0.6.0 h1:/Vq78uSIdUSZ3iqDc9PESKtwt8YqNKN6u+khD+lLjuw= +github.com/hashicorp/terraform-plugin-log v0.6.0/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4= github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c h1:D8aRO6+mTqHfLsK/BC3j5OAoogv1WLRWzY1AaTo3rBg= github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c/go.mod h1:Wn3Na71knbXc1G8Lh+yu/dQWWJeFQEpDeJMtWMtlmNI= github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0= From 83bbc12e706259922b322a6108eb98fe022367c2 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Fri, 15 Jul 2022 14:15:18 -0400 Subject: [PATCH 2/3] internal/logging: Use SetField() instead of With() --- internal/logging/context.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/logging/context.go b/internal/logging/context.go index 38ef4e35..385283bb 100644 --- a/internal/logging/context.go +++ b/internal/logging/context.go @@ -10,9 +10,9 @@ import ( // DataSourceContext injects the data source type into logger contexts. func DataSourceContext(ctx context.Context, dataSource string) context.Context { - ctx = tfsdklog.With(ctx, KeyDataSourceType, dataSource) - ctx = tfsdklog.SubsystemWith(ctx, SubsystemProto, KeyDataSourceType, dataSource) - ctx = tflog.With(ctx, KeyDataSourceType, dataSource) + ctx = tfsdklog.SetField(ctx, KeyDataSourceType, dataSource) + ctx = tfsdklog.SubsystemSetField(ctx, SubsystemProto, KeyDataSourceType, dataSource) + ctx = tflog.SetField(ctx, KeyDataSourceType, dataSource) return ctx } @@ -41,16 +41,16 @@ func ProtoSubsystemContext(ctx context.Context, sdkOpts tfsdklog.Options) contex // ProtocolVersionContext injects the protocol version into logger contexts. func ProtocolVersionContext(ctx context.Context, protocolVersion string) context.Context { - ctx = tfsdklog.SubsystemWith(ctx, SubsystemProto, KeyProtocolVersion, protocolVersion) + ctx = tfsdklog.SubsystemSetField(ctx, SubsystemProto, KeyProtocolVersion, protocolVersion) return ctx } // ProviderAddressContext injects the provider address into logger contexts. func ProviderAddressContext(ctx context.Context, providerAddress string) context.Context { - ctx = tfsdklog.With(ctx, KeyProviderAddress, providerAddress) - ctx = tfsdklog.SubsystemWith(ctx, SubsystemProto, KeyProviderAddress, providerAddress) - ctx = tflog.With(ctx, KeyProviderAddress, providerAddress) + ctx = tfsdklog.SetField(ctx, KeyProviderAddress, providerAddress) + ctx = tfsdklog.SubsystemSetField(ctx, SubsystemProto, KeyProviderAddress, providerAddress) + ctx = tflog.SetField(ctx, KeyProviderAddress, providerAddress) return ctx } @@ -63,27 +63,27 @@ func RequestIdContext(ctx context.Context) context.Context { reqID = "unable to assign request ID: " + err.Error() } - ctx = tfsdklog.With(ctx, KeyRequestID, reqID) - ctx = tfsdklog.SubsystemWith(ctx, SubsystemProto, KeyRequestID, reqID) - ctx = tflog.With(ctx, KeyRequestID, reqID) + ctx = tfsdklog.SetField(ctx, KeyRequestID, reqID) + ctx = tfsdklog.SubsystemSetField(ctx, SubsystemProto, KeyRequestID, reqID) + ctx = tflog.SetField(ctx, KeyRequestID, reqID) return ctx } // ResourceContext injects the resource type into logger contexts. func ResourceContext(ctx context.Context, resource string) context.Context { - ctx = tfsdklog.With(ctx, KeyResourceType, resource) - ctx = tfsdklog.SubsystemWith(ctx, SubsystemProto, KeyResourceType, resource) - ctx = tflog.With(ctx, KeyResourceType, resource) + ctx = tfsdklog.SetField(ctx, KeyResourceType, resource) + ctx = tfsdklog.SubsystemSetField(ctx, SubsystemProto, KeyResourceType, resource) + ctx = tflog.SetField(ctx, KeyResourceType, resource) return ctx } // RpcContext injects the RPC name into logger contexts. func RpcContext(ctx context.Context, rpc string) context.Context { - ctx = tfsdklog.With(ctx, KeyRPC, rpc) - ctx = tfsdklog.SubsystemWith(ctx, SubsystemProto, KeyRPC, rpc) - ctx = tflog.With(ctx, KeyRPC, rpc) + ctx = tfsdklog.SetField(ctx, KeyRPC, rpc) + ctx = tfsdklog.SubsystemSetField(ctx, SubsystemProto, KeyRPC, rpc) + ctx = tflog.SetField(ctx, KeyRPC, rpc) return ctx } From 5c0d70acc99c319fbb3dc1827eb28548f59c9b38 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Fri, 15 Jul 2022 14:15:42 -0400 Subject: [PATCH 3/3] Update CHANGELOG for #209 --- .changelog/209.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/209.txt diff --git a/.changelog/209.txt b/.changelog/209.txt new file mode 100644 index 00000000..2a7cfbef --- /dev/null +++ b/.changelog/209.txt @@ -0,0 +1,3 @@ +```release-note:note +The underlying `terraform-plugin-log` dependency has been updated to v0.6.0, which includes log filtering support and breaking changes of `With()` to `SetField()` function names. Any provider logging which calls those functions may require updates. +```