Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tflog+tfsdklog: Provide Option to Copy Existing With Keys During NewSubsystem #59

Closed
bflad opened this issue May 3, 2022 · 1 comment · Fixed by #60
Closed

tflog+tfsdklog: Provide Option to Copy Existing With Keys During NewSubsystem #59

bflad opened this issue May 3, 2022 · 1 comment · Fixed by #60
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@bflad
Copy link
Contributor

bflad commented May 3, 2022

terraform-plugin-log version

v0.3.0

Use cases

Currently when creating tflog or tfsdklog subsystems, the new subsystem has none of the parent With() keys. While this is generally desirable, there are cases where a subsystem should also include the parent keys for context, e.g. the framework subsystem. Otherwise, you lose context such as:

2022-05-03T16:40:48.546-0400 [TRACE] sdk.proto: Received request: tf_proto_version=6.0 tf_provider_addr=registry.terraform.io/hashicorp/framework tf_req_id=844ea3c5-a119-9176-f8cb-33ddfc823135 tf_resource_type=framework_user tf_rpc=ApplyResourceChange
2022-05-03T16:40:48.546-0400 [TRACE] sdk.proto: Calling downstream: tf_proto_version=6.0 tf_provider_addr=registry.terraform.io/hashicorp/framework tf_req_id=844ea3c5-a119-9176-f8cb-33ddfc823135 tf_resource_type=framework_user tf_rpc=ApplyResourceChange
2022-05-03T16:40:48.546-0400 [DEBUG] sdk.framework: Calling provider defined Provider GetResources
2022-05-03T16:40:48.546-0400 [DEBUG] sdk.framework: Called provider defined Provider GetResources

Proposal

  • Add IncludeRootFields bool to logging.Option
  • Create WithRootFields() logging.Option in tflog and tfsdklog
  • If opts.IncludeRootFields is detected in NewSubsystem(), grab root fields via (Logger).ImpliedArgs() and call With on the new subsystem logger.
@bflad bflad added the enhancement New feature or request label May 3, 2022
@bflad bflad added this to the v0.4.0 milestone May 3, 2022
@bflad bflad self-assigned this May 3, 2022
bflad added a commit that referenced this issue May 3, 2022
@bflad bflad closed this as completed in #60 May 4, 2022
bflad added a commit that referenced this issue May 4, 2022
@github-actions
Copy link

github-actions bot commented Jun 4, 2022

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant