diag

package
v3.100.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 8 Imported by: 91

Documentation

Index

Constants

View Source
const DefaultSinkIDPrefix = "PU"

Variables

This section is empty.

Functions

This section is empty.

Types

type Diag

type Diag struct {
	URN     resource.URN // Resource this diagnostics is associated with.  Empty if not associated with any resource.
	ID      ID           // a unique identifier for this diagnostic.
	Message string       // a human-friendly message for this diagnostic.
	Raw     bool         // true if this diagnostic should not be formatted when displayed.

	// An ID used to collate a stream of conceptually sequential messages.  0 means that the message
	// is not part of any sequential message stream.
	StreamID int32
}

Diag is an instance of an error or warning generated by the compiler.

func GetBadProviderError

func GetBadProviderError(urn resource.URN) *Diag

func GetCannotDeleteParentResourceWithoutAlsoDeletingChildError

func GetCannotDeleteParentResourceWithoutAlsoDeletingChildError(urn resource.URN) *Diag

func GetDefaultProviderDenied added in v3.23.0

func GetDefaultProviderDenied(urn resource.URN) *Diag

func GetDuplicateResourceAliasError

func GetDuplicateResourceAliasError(urn resource.URN) *Diag

func GetDuplicateResourceAliasedError added in v3.46.0

func GetDuplicateResourceAliasedError(urn resource.URN) *Diag

func GetDuplicateResourceURNError

func GetDuplicateResourceURNError(urn resource.URN) *Diag

func GetPreviewFailedError

func GetPreviewFailedError(urn resource.URN) *Diag

func GetResourceInvalidError

func GetResourceInvalidError(urn resource.URN) *Diag

func GetResourceOperationFailedError

func GetResourceOperationFailedError(urn resource.URN) *Diag

func GetResourcePropertyInvalidValueError

func GetResourcePropertyInvalidValueError(urn resource.URN) *Diag

func GetResourceWillBeCreatedButWasNotSpecifiedInTargetList

func GetResourceWillBeCreatedButWasNotSpecifiedInTargetList(urn resource.URN) *Diag

func GetResourceWillBeDestroyedButWasNotSpecifiedInTargetList

func GetResourceWillBeDestroyedButWasNotSpecifiedInTargetList(urn resource.URN) *Diag

func GetTargetCouldNotBeFoundDidYouForgetError

func GetTargetCouldNotBeFoundDidYouForgetError() *Diag

func GetTargetCouldNotBeFoundError

func GetTargetCouldNotBeFoundError() *Diag

func GetUnknownProviderError

func GetUnknownProviderError(urn resource.URN) *Diag

func Message

func Message(urn resource.URN, msg string) *Diag

Message returns an anonymous diagnostic message without any source or ID information.

func RawMessage

func RawMessage(urn resource.URN, msg string) *Diag

RawMessage returns an anonymous diagnostic message without any source or ID information that will not be rendered with Sprintf.

func StreamMessage

func StreamMessage(urn resource.URN, msg string, streamID int32) *Diag

StreamMessage returns an anonymous diagnostic message without any source or ID information that is associated with the given stream ID. Displays can use this ID to combine all the messages from a single stream into an entire message, while still rendering the pieces as they come in.

type FormatOptions

type FormatOptions struct {
	Pwd   string              // the working directory.
	Color colors.Colorization // how output should be colorized.
	Debug bool                // if true, debugging will be output to stdout.
}

FormatOptions controls the output style and content.

type ID

type ID int

ID is a unique diagnostics identifier.

type Severity

type Severity string

Severity dictates the kind of diagnostic.

const (
	Debug   Severity = "debug"
	Info    Severity = "info"
	Infoerr Severity = "info#err"
	Warning Severity = "warning"
	Error   Severity = "error"
)

type Sink

type Sink interface {
	// Logf issues a log message.
	Logf(sev Severity, diag *Diag, args ...interface{})
	// Debugf issues a debugging message.
	Debugf(diag *Diag, args ...interface{})
	// Infof issues an informational message (to stdout).
	Infof(diag *Diag, args ...interface{})
	// Infoerrf issues an informational message (to stderr).
	Infoerrf(diag *Diag, args ...interface{})
	// Errorf issues a new error diagnostic.
	Errorf(diag *Diag, args ...interface{})
	// Warningf issues a new warning diagnostic.
	Warningf(diag *Diag, args ...interface{})

	// Stringify stringifies a diagnostic into a prefix and message that is appropriate for printing.
	Stringify(sev Severity, diag *Diag, args ...interface{}) (string, string)
}

Sink facilitates pluggable diagnostics messages.

func DefaultSink

func DefaultSink(stdout io.Writer, stderr io.Writer, opts FormatOptions) Sink

DefaultSink returns a default sink that simply logs output to stderr/stdout.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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