message

package
v0.24.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package message provides a rich set of functions for displaying messages to the user.

Package message provides a rich set of functions for displaying messages to the user.

Package message provides a rich set of functions for displaying messages to the user.

Package message provides a rich set of functions for displaying messages to the user.

Package message provides a rich set of functions for displaying messages to the user.

Package message provides a rich set of functions for displaying messages to the user.

Index

Constants

This section is empty.

Variables

View Source
var NoProgress bool

NoProgress tracks whether spinner/progress bars show updates.

Functions

func Debug

func Debug(payload ...any)

Debug prints a debug message.

func Debugf

func Debugf(format string, a ...any)

Debugf prints a debug message.

func Error

func Error(err any, message string)

Error prints an error message.

func ErrorWebf

func ErrorWebf(err any, w http.ResponseWriter, format string, a ...any)

ErrorWebf prints an error message and returns a web response.

func Errorf

func Errorf(err any, format string, a ...any)

Errorf prints an error message.

func Fatal

func Fatal(err any, message string)

Fatal prints a fatal error message and exits with a 1.

func Fatalf

func Fatalf(err any, format string, a ...any)

Fatalf prints a fatal error message and exits with a 1.

func GetLogo() string

GetLogo returns the awesome menu ascii logo.

func HeaderInfof

func HeaderInfof(format string, a ...any)

HeaderInfof prints a large header with a formatted message.

func Info

func Info(message string)

Info prints an info message.

func Infof

func Infof(format string, a ...any)

Infof prints an info message.

func JSONValue

func JSONValue(value any) string

JSONValue prints any value as JSON.

func Note

func Note(text string)

Note prints a formatted yellow message.

func Notef

func Notef(format string, a ...any)

Notef prints a formatted yellow message.

func PrintConnectStringTable

func PrintConnectStringTable(connectStrings types.ConnectStrings)

PrintConnectStringTable prints a table of connect strings.

func Question

func Question(text string)

Question prints a formatted message used in conjunction with a user prompt.

func SetLogLevel

func SetLogLevel(lvl LogLevel)

SetLogLevel sets the log level.

func SuccessF

func SuccessF(format string, a ...any)

SuccessF prints a success message.

func UseLogFile

func UseLogFile()

UseLogFile writes output to stderr and a logFile.

func Warn

func Warn(message string)

Warn prints a warning message.

func Warnf

func Warnf(format string, a ...any)

Warnf prints a warning message.

Types

type Generic

type Generic struct{}

Generic is used to implement the io.Writer interface for generic messages.

func (*Generic) Write

func (g *Generic) Write(p []byte) (n int, err error)

type LogLevel

type LogLevel int

LogLevel is the level of logging to display.

const (
	// WarnLevel level. Non-critical entries that deserve eyes.
	WarnLevel LogLevel = iota
	// InfoLevel level. General operational entries about what's going on inside the
	// application.
	InfoLevel
	// DebugLevel level. Usually only enabled when debugging. Very verbose logging.
	DebugLevel
	// TraceLevel level. Designates finer-grained informational events than the Debug.
	TraceLevel
)

func GetLogLevel

func GetLogLevel() LogLevel

GetLogLevel returns the current log level.

type ProgressBar

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

ProgressBar is a struct used to drive a pterm ProgressbarPrinter.

func NewProgressBar

func NewProgressBar(total int64, format string, a ...any) *ProgressBar

NewProgressBar creates a new ProgressBar instance from a total value and a format.

func (*ProgressBar) Fatalf

func (p *ProgressBar) Fatalf(err error, format string, a ...any)

Fatalf marks the ProgressBar as failed in the CLI.

func (*ProgressBar) Stop

func (p *ProgressBar) Stop()

Stop stops the ProgressBar from continuing.

func (*ProgressBar) Success

func (p *ProgressBar) Success(text string, a ...any)

Success marks the ProgressBar as successful in the CLI.

func (*ProgressBar) Update

func (p *ProgressBar) Update(complete int64, text string)

Update updates the ProgressBar with completed progress and new text.

func (*ProgressBar) Write

func (p *ProgressBar) Write(data []byte) (int, error)

Write updates the ProgressBar with the number of bytes in a buffer as the completed progress.

type Spinner

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

Spinner is a wrapper around pterm.SpinnerPrinter.

func NewProgressSpinner

func NewProgressSpinner(format string, a ...any) *Spinner

NewProgressSpinner creates a new progress spinner.

func (*Spinner) Errorf

func (p *Spinner) Errorf(err error, format string, a ...any)

Errorf prints an error message with the spinner.

func (*Spinner) Fatal

func (p *Spinner) Fatal(err error)

Fatal calls message.Fatalf with the given error.

func (*Spinner) Fatalf

func (p *Spinner) Fatalf(err error, format string, a ...any)

Fatalf calls message.Fatalf with the given error and format.

func (*Spinner) Stop

func (p *Spinner) Stop()

Stop the spinner.

func (*Spinner) Success

func (p *Spinner) Success()

Success prints a success message and stops the spinner.

func (*Spinner) Successf

func (p *Spinner) Successf(format string, a ...any)

Successf prints a success message with the spinner and stops it.

func (*Spinner) Updatef

func (p *Spinner) Updatef(format string, a ...any)

Updatef updates the spinner text.

func (*Spinner) Warnf

func (p *Spinner) Warnf(format string, a ...any)

Warnf prints a warning message with the spinner.

func (*Spinner) Write

func (p *Spinner) Write(text []byte) (int, error)

Write the given text to the spinner.

Jump to

Keyboard shortcuts

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