logging

package
v3.103.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CtxKey = ctxKey{}

The key used to retrieve tfbridge.Logger from a context.

Functions

func InitLogging

func InitLogging(ctx context.Context, opts LogOptions) context.Context

Sets up Context-scoped loggers to route Terraform logs to the Pulumi CLI process so they are visible to the user.

Log verbosity is controlled by the TF_LOG environment variable (set to TRACE, DEBUG, INFO, WARN, ERROR or OFF). By default, INFO-level logs are emitted.

See also:

- https://developer.hashicorp.com/terraform/plugin/log/writing - https://www.pulumi.com/docs/support/troubleshooting

Types

type LogOptions

type LogOptions struct {
	LogSink         Sink
	ProviderName    string
	ProviderVersion string
	URN             resource.URN
}

See InitLogging.

type Sink

type Sink interface {
	Log(context context.Context, sev diag.Severity, urn resource.URN, msg string) error
	LogStatus(context context.Context, sev diag.Severity, urn resource.URN, msg string) error
}

Abstracts the logging interface to HostClient. This is the interface providers use to report logging information back to the Pulumi CLI over gRPC.

func NewDiscardSink added in v3.103.0

func NewDiscardSink() Sink

This logging sink discards all messages.

func NewTestingSink added in v3.103.0

func NewTestingSink(t T) Sink

Build a Sink that flushes to *testing.T or a similar context.

type T added in v3.103.0

type T interface {
	Logf(string, ...any)
}

Methods required by NewTestingSink from *testing.T.

Jump to

Keyboard shortcuts

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