-
Notifications
You must be signed in to change notification settings - Fork 232
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
helper/resource: Added terraform-plugin-log logger and extensive log entries #891
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A tiny nitpick, but otherwise LGTM.
internal/logging/helper_resource.go
Outdated
// HelperResourceDebug emits a helper/resource subsystem log at DEBUG level. | ||
func HelperResourceDebug(ctx context.Context, msg string, args ...interface{}) { | ||
tfsdklog.SubsystemDebug(ctx, SubsystemHelperResource, msg, args) | ||
} | ||
|
||
// HelperResourceError emits a helper/resource subsystem log at ERROR level. | ||
func HelperResourceError(ctx context.Context, msg string, args ...interface{}) { | ||
tfsdklog.SubsystemError(ctx, SubsystemHelperResource, msg, args) | ||
} | ||
|
||
// HelperResourceTrace emits a helper/resource subsystem log at TRACE level. | ||
func HelperResourceTrace(ctx context.Context, msg string, args ...interface{}) { | ||
tfsdklog.SubsystemTrace(ctx, SubsystemHelperResource, msg, args) | ||
} | ||
|
||
// HelperResourceWarn emits a helper/resource subsystem log at WARN level. | ||
func HelperResourceWarn(ctx context.Context, msg string, args ...interface{}) { | ||
tfsdklog.SubsystemWarn(ctx, SubsystemHelperResource, msg, args) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: would prefer if those functions where either sorted "trace, debug, warn, error" or "error, warn, debug, trace".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typically I'll code function/method definitions alphabetically, but pushed up the ordering change.
…entries Reference: #838 This new subsystem logger is meant for instrumenting the acceptance testing framework. Most of the changes are to support passing the context to many of the functions and adding `DEBUG`/`TRACE` log entries for provider developer and SDK maintainer troubleshooting. Verified `go test` logging behaviors via terraform-provider-corner: - No logs by default - `TF_LOG_SDK_HELPER_RESOURCE` environment variable control of new logger - `TF_LOG` enabling new logger - `TF_ACC_LOG_PATH` enabling new logger
6ade90a
to
55ec1bb
Compare
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Closes #838
This new subsystem logger is meant for instrumenting the acceptance testing framework. Most of the changes are to support passing the context to many of the functions and adding
DEBUG
/TRACE
log entries for provider developer and SDK maintainer troubleshooting.Verified
go test
logging behaviors via terraform-provider-corner:TF_LOG_SDK_HELPER_RESOURCE
environment variable control of new loggerTF_LOG
enabling new loggerTF_ACC_LOG_PATH
enabling new logger