logging

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2022 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package logging contains framework internal helpers for consistent logger and log entry handling.

Index

Constants

View Source
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"

	// Human readable string when calling a provider defined type that must
	// implement the Description() method, such as validators.
	KeyDescription = "description"

	// Underlying Go error string when logging an error.
	KeyError = "error"

	// The type of resource being operated on, such as "random_pet"
	KeyResourceType = "tf_resource_type"
)

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.

View Source
const (
	// EnvTfLogSdkFramework is an environment variable that sets the logging
	// level of SDK framework loggers. Infers root SDK logging level, if
	// unset.
	EnvTfLogSdkFramework = "TF_LOG_SDK_FRAMEWORK"
)

Environment variables.

View Source
const (
	// SubsystemFramework is the tfsdklog subsystem name for framework.
	SubsystemFramework = "framework"
)

Variables

This section is empty.

Functions

func FrameworkDebug

func FrameworkDebug(ctx context.Context, msg string, additionalFields ...map[string]interface{})

FrameworkDebug emits a framework subsystem log at DEBUG level.

func FrameworkError

func FrameworkError(ctx context.Context, msg string, additionalFields ...map[string]interface{})

FrameworkError emits a framework subsystem log at ERROR level.

func FrameworkTrace

func FrameworkTrace(ctx context.Context, msg string, additionalFields ...map[string]interface{})

FrameworkTrace emits a framework subsystem log at TRACE level.

func FrameworkWarn

func FrameworkWarn(ctx context.Context, msg string, additionalFields ...map[string]interface{})

FrameworkWarn emits a framework subsystem log at WARN level.

func FrameworkWithAttributePath

func FrameworkWithAttributePath(ctx context.Context, attributePath string) context.Context

FrameworkWithAttributePath returns a new Context with KeyAttributePath set. The attribute path is expected to be string, so the logging package does not need to import path handling code.

func InitContext

func InitContext(ctx context.Context) context.Context

InitContext creates SDK logger contexts. The incoming context will already have the root SDK logger and root provider logger setup from terraform-plugin-go tf6server RPC handlers.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL