Documentation ¶
Index ¶
- Constants
- func HelperResourceDebug(ctx context.Context, msg string, additionalFields ...map[string]interface{})
- func HelperResourceError(ctx context.Context, msg string, additionalFields ...map[string]interface{})
- func HelperResourceTrace(ctx context.Context, msg string, additionalFields ...map[string]interface{})
- func HelperResourceWarn(ctx context.Context, msg string, additionalFields ...map[string]interface{})
- func HelperSchemaDebug(ctx context.Context, msg string, additionalFields ...map[string]interface{})
- func HelperSchemaTrace(ctx context.Context, msg string, additionalFields ...map[string]interface{})
- func HelperSchemaWarn(ctx context.Context, msg string, additionalFields ...map[string]interface{})
- func InitContext(ctx context.Context) context.Context
- func InitTestContext(ctx context.Context, t testing.T) context.Context
- func TestNameContext(ctx context.Context, testName string) context.Context
- func TestStepNumberContext(ctx context.Context, stepNumber int) context.Context
- func TestTerraformPathContext(ctx context.Context, terraformPath string) context.Context
- func TestWorkingDirectoryContext(ctx context.Context, workingDirectory string) context.Context
Constants ¶
const ( // EnvTfLogSdkHelperResource is an environment variable that sets the logging // level of SDK helper/resource loggers. Infers root SDK logging level, if // unset. EnvTfLogSdkHelperResource = "TF_LOG_SDK_HELPER_RESOURCE" // EnvTfLogSdkHelperSchema is an environment variable that sets the logging // level of SDK helper/schema loggers. Infers root SDK logging level, if // unset. EnvTfLogSdkHelperSchema = "TF_LOG_SDK_HELPER_SCHEMA" )
Environment variables.
const ( // Attribute path representation, which is typically in flatmap form such // as parent.0.child in this project. KeyAttributePath = "tf_attribute_path" // The type of data source being operated on, such as "archive_file" KeyDataSourceType = "tf_data_source_type" // Underlying Go error string when logging an error. KeyError = "error" // The full address of the provider, such as // registry.terraform.io/hashicorp/random KeyProviderAddress = "tf_provider_addr" // The type of resource being operated on, such as "random_pet" KeyResourceType = "tf_resource_type" // The name of the test being executed. KeyTestName = "test_name" // The TestStep number of the test being executed. Starts at 1. KeyTestStepNumber = "test_step_number" // The path to the Terraform CLI used for an acceptance test. KeyTestTerraformPath = "test_terraform_path" // The working directory of the acceptance test. KeyTestWorkingDirectory = "test_working_directory" )
Structured logging keys.
Practitioners or tooling reading logs may be depending on these keys, so be conscious of that when changing them.
Refer to the terraform-plugin-go logging keys as well, which should be equivalent to these when possible.
const (
// SubsystemHelperResource is the tfsdklog subsystem name for helper/resource.
SubsystemHelperResource = "helper_resource"
)
const (
// SubsystemHelperSchema is the tfsdklog subsystem name for helper/schema.
SubsystemHelperSchema = "helper_schema"
)
Variables ¶
This section is empty.
Functions ¶
func HelperResourceDebug ¶
func HelperResourceDebug(ctx context.Context, msg string, additionalFields ...map[string]interface{})
HelperResourceDebug emits a helper/resource subsystem log at DEBUG level.
func HelperResourceError ¶
func HelperResourceError(ctx context.Context, msg string, additionalFields ...map[string]interface{})
HelperResourceError emits a helper/resource subsystem log at ERROR level.
func HelperResourceTrace ¶
func HelperResourceTrace(ctx context.Context, msg string, additionalFields ...map[string]interface{})
HelperResourceTrace emits a helper/resource subsystem log at TRACE level.
func HelperResourceWarn ¶
func HelperResourceWarn(ctx context.Context, msg string, additionalFields ...map[string]interface{})
HelperResourceWarn emits a helper/resource subsystem log at WARN level.
func HelperSchemaDebug ¶
HelperSchemaDebug emits a helper/schema subsystem log at DEBUG level.
func HelperSchemaTrace ¶
HelperSchemaTrace emits a helper/schema subsystem log at TRACE level.
func HelperSchemaWarn ¶
HelperSchemaWarn emits a helper/schema subsystem log at WARN level.
func InitContext ¶
InitContext creates SDK logger contexts.
func InitTestContext ¶
InitTestContext registers the terraform-plugin-log/tfsdklog test sink, configures the standard library log package, and creates SDK logger contexts.
It may be possible to eliminate the helper/logging handling if all log package calls are replaced with tfsdklog and any go-plugin or terraform-exec logger configurations are updated to the tfsdklog logger.
func TestNameContext ¶
TestNameContext adds the current test name to loggers.
func TestStepNumberContext ¶
TestStepNumberContext adds the current test step number to loggers.
func TestTerraformPathContext ¶
TestTerraformPathContext adds the current test Terraform CLI path to loggers.
Types ¶
This section is empty.