util

package
v0.25.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDefaultUploadTagRef added in v0.24.0

func BuildDefaultUploadTagRef(item WithDigest, importRepo regname.Repository) (regname.Tag, error)

BuildDefaultUploadTagRef Builds a tag from the digest Algorithm and Digest

func Retry

func Retry(doFunc func() error) error

Types

type LogLevel

type LogLevel int

LogLevel specifies logging level (i.e. DEBUG, WARN)

const (
	LogTrace LogLevel = iota
	LogDebug LogLevel = iota
	LogWarn  LogLevel = iota
)

type NonRetryableError

type NonRetryableError struct {
	Message string
}

func (NonRetryableError) Error

func (n NonRetryableError) Error() string

type ProgressBarLogger

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

func (*ProgressBarLogger) End

func (l *ProgressBarLogger) End()

func (*ProgressBarLogger) Start

func (l *ProgressBarLogger) Start(progressChan <-chan regv1.Update)

type ProgressBarNoTTYLogger

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

func (*ProgressBarNoTTYLogger) End

func (l *ProgressBarNoTTYLogger) End()

func (*ProgressBarNoTTYLogger) Start

func (l *ProgressBarNoTTYLogger) Start(progressChan <-chan regv1.Update)

type ProgressLogger

type ProgressLogger interface {
	Start(progress <-chan regv1.Update)
	End()
}

func NewProgressBar

func NewProgressBar(ui goui.UI, finalMessage, errorMessagePrefix string) ProgressLogger

NewProgressBar constructor to build a ProgressLogger responsible for printing out a progress bar using updates when writing to a registry via ggcr

type Throttle

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

func NewThrottle

func NewThrottle(max int) Throttle

func (Throttle) Done

func (t Throttle) Done()

func (Throttle) Take

func (t Throttle) Take()

type UILevelWriter

type UILevelWriter struct {
	goui.UI
	LogLevel LogLevel
}

UILevelWriter allows specifying a log level to a ui.UI

func NewUILevelLogger

func NewUILevelLogger(level LogLevel, ui goui.UI) *UILevelWriter

NewUILevelLogger is a UILevelWriter constructor, wrapping a ui.UI with a specific log level

func (UILevelWriter) Debugf

func (l UILevelWriter) Debugf(msg string, args ...interface{})

Debugf used to log debug related messages

func (UILevelWriter) Errorf

func (l UILevelWriter) Errorf(msg string, args ...interface{})

Errorf used to log error related messages

func (UILevelWriter) Logf

func (l UILevelWriter) Logf(msg string, args ...interface{})

Logf logs the provided message

func (UILevelWriter) Tracef

func (l UILevelWriter) Tracef(msg string, args ...interface{})

Tracef used to log trace related messages

func (UILevelWriter) Warnf

func (l UILevelWriter) Warnf(msg string, args ...interface{})

Warnf used to log warning related messages

type UIPrefixWriter

type UIPrefixWriter struct {
	goui.UI
	// contains filtered or unexported fields
}

UIPrefixWriter prints a prefix when the underlying ui prints a message

func NewUIPrefixedWriter

func NewUIPrefixedWriter(prefix string, ui goui.UI) *UIPrefixWriter

NewUIPrefixedWriter constructor for building a UI with a prefix when logging a message

func (*UIPrefixWriter) BeginLinef

func (w *UIPrefixWriter) BeginLinef(msg string, args ...interface{})

BeginLinef writes a message and args adding a configured prefix

func (*UIPrefixWriter) Write

func (w *UIPrefixWriter) Write(data []byte) (int, error)

type UIWithLevels

type UIWithLevels interface {
	goui.UI

	Errorf(msg string, args ...interface{})
	Warnf(msg string, args ...interface{})
	Debugf(msg string, args ...interface{})
	Tracef(msg string, args ...interface{})
}

UIWithLevels wraps a ui.UI with logging levels

type WithDigest added in v0.24.0

type WithDigest interface {
	Digest() (regv1.Hash, error)
}

WithDigest are items that Digest() can be called on

Jump to

Keyboard shortcuts

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