bard

package
v1.72.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 8 Imported by: 315

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatIdentity added in v1.8.0

func FormatIdentity(name string, description string) string

FormatIdentity formats a name and an optional description in the form '<b>name</b>[ description]'.

Types

type IdentifiableError

type IdentifiableError struct {

	// Name is the name of the identified object.
	Name string

	// Description is the description of the identified object.
	Description string

	// Err is the nested error.
	Err error
}

IdentifiableError is an error associated with an Identifiable for logging purposes.

func (IdentifiableError) Error

func (i IdentifiableError) Error() string

type Logger

type Logger struct {
	poet.Logger
	// contains filtered or unexported fields
}

Logger logs message to a writer.

func NewLogger

func NewLogger(writer io.Writer) Logger

NewLogger creates a new instance of Logger. It configures debug logging if $BP_DEBUG is set.

func NewLoggerWithOptions

func NewLoggerWithOptions(writer io.Writer, options ...Option) Logger

NewLoggerWithOptions create a new instance of Logger. It configures the Logger with options.

func (Logger) Body

func (l Logger) Body(a ...interface{})

Body formats using the default formats for its operands and logs a message to the configured body writer. Spaces are added between operands when neither is a string.

func (Logger) BodyWriter

func (l Logger) BodyWriter() io.Writer

BodyWriter returns the configured body writer.

func (Logger) Bodyf added in v1.20.0

func (l Logger) Bodyf(format string, a ...interface{})

Bodyf formats according to a format specifier and logs a message to the configured body writer.

func (Logger) Header

func (l Logger) Header(a ...interface{})

Header formats using the default formats for its operands and logs a message to the configured header writer. Spaces are added between operands when neither is a string.

func (Logger) HeaderWriter

func (l Logger) HeaderWriter() io.Writer

HeaderWriter returns the configured header writer.

func (Logger) Headerf added in v1.20.0

func (l Logger) Headerf(format string, a ...interface{})

Headerf formats according to a format specifier and logs a message to the configured header writer.

func (Logger) IsBodyEnabled

func (l Logger) IsBodyEnabled() bool

IsBodyEnabled indicates whether body logging is enabled.

func (Logger) IsHeaderEnabled

func (l Logger) IsHeaderEnabled() bool

IsHeaderEnabled indicates whether header logging is enabled.

func (Logger) IsTerminalErrorEnabled

func (l Logger) IsTerminalErrorEnabled() bool

IsTerminalErrorEnabled indicates whether terminal error logging is enabled.

func (Logger) IsTitleEnabled

func (l Logger) IsTitleEnabled() bool

IsTitleEnabled indicates whether title logging is enabled.

func (Logger) TerminalError

func (l Logger) TerminalError(err IdentifiableError)

TerminalError logs a message to the configured terminal error writer.

func (Logger) TerminalErrorWriter

func (l Logger) TerminalErrorWriter() io.Writer

TerminalErrorWriter returns the configured terminal error writer.

func (Logger) Title

func (l Logger) Title(buildpack libcnb.Buildpack)

Title logs a message to the configured title writer.

func (Logger) TitleWriter

func (l Logger) TitleWriter() io.Writer

TitleWriter returns the configured title writer.

type Option

type Option func(logger Logger) Logger

Option is a function for configuring a Logger instance.

func LogLevel added in v1.52.0

func LogLevel(options []Option, writer io.Writer) []Option

func WithDebug

func WithDebug(writer io.Writer) Option

WithDebug configures the debug Writer.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer is an object that will indent and color all output flowing through it.

func NewWriter

func NewWriter(writer io.Writer, options ...WriterOption) *Writer

NewWriter creates a instance that wraps another writer.

func (*Writer) Write

func (w *Writer) Write(b []byte) (int, error)

type WriterOption

type WriterOption func(Writer) Writer

WriterOption is a function for configuring a Writer instance.

func WithAttributes

func WithAttributes(attributes ...color.Attribute) WriterOption

WithAttributes creates an WriterOption that sets the output color.

func WithIndent

func WithIndent(indent int) WriterOption

WithIndent creates an WriterOption that sets the depth of the output indent.

Jump to

Keyboard shortcuts

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