cli

package
v0.0.0-...-d426aa2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const OutputKey = "output"
View Source
const WriterKey = "log-writer"

Variables

This section is empty.

Functions

func ContextWithLogWriter

func ContextWithLogWriter(ctx context.Context, w io.Writer) context.Context

func ContextWithOutput

func ContextWithOutput(ctx context.Context, output OutputType) context.Context

func DeprecationWarning

func DeprecationWarning(opts *DeprecationOptions)

func HandleErr

func HandleErr(err error)

func LogWriterFromContext

func LogWriterFromContext(ctx context.Context) io.Writer

LogWriterFromContext returns the currently configured log writer for reuse in routine loggers

func PrintExitError

func PrintExitError(summary string, detail ...string)

Types

type BufferedWriter

type BufferedWriter struct {
	io.Writer
	// contains filtered or unexported fields
}

BufferedWriter is a writer that buffers all writes until Flush is called. This is useful in go routines where we don't want the logs to be mixed up between routines

func NewBufferedWriter

func NewBufferedWriter(w io.Writer, github bool, identifier string) *BufferedWriter

func (*BufferedWriter) Flush

func (b *BufferedWriter) Flush() error

Flush writes all buffered data to the inner writer

func (*BufferedWriter) Write

func (b *BufferedWriter) Write(p []byte) (n int, err error)

type DeprecationOptions

type DeprecationOptions struct {
	Site      string
	Component string
	Message   string
	Details   string
	Version   string
}

type GroupedError

type GroupedError struct {
	Errors []error
	// contains filtered or unexported fields
}

func NewGroupedError

func NewGroupedError(msg string, errors []error) *GroupedError

func (*GroupedError) Error

func (b *GroupedError) Error() string

type LogLine

type LogLine struct {
	Level     string                 `mapstructure:"@level"`
	Message   string                 `mapstructure:"@message"`
	Module    string                 `mapstructure:"@module"`
	Timestamp string                 `mapstructure:"@timestamp"`
	Remainder map[string]interface{} `mapstructure:",remain"`
}

func ParseTerraformJsonOutput

func ParseTerraformJsonOutput(message string) ([]LogLine, error)

type MetaData

type MetaData struct {
	Version     string
	Commit      string
	ShortCommit string
	Date        string
}

func GetVersionMetadata

func GetVersionMetadata() *MetaData

func (*MetaData) ShortHash

func (md *MetaData) ShortHash() string

func (*MetaData) String

func (md *MetaData) String() string

type OutputType

type OutputType string
const (
	OutputTypeConsole OutputType = "console"
	OutputTypeJSON    OutputType = "json"
)

func OutputFromContext

func OutputFromContext(ctx context.Context) OutputType

OutputFromContext returns the output type from the context. If no output type is set console is returned

Jump to

Keyboard shortcuts

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