Documentation ¶
Overview ¶
Package util contains internal utility tools used in imgpkg
Index ¶
- func Retry(doFunc func() error) error
- type BufferLogger
- type LevelLogger
- func (l LevelLogger) Debugf(msg string, args ...interface{})
- func (l LevelLogger) Errorf(msg string, args ...interface{})
- func (l LevelLogger) Level() LogLevel
- func (l LevelLogger) Logf(msg string, args ...interface{})
- func (l LevelLogger) Tracef(msg string, args ...interface{})
- func (l LevelLogger) Warnf(msg string, args ...interface{})
- type LogLevel
- type LogLevelRetriever
- type Logger
- type LoggerWithLevels
- type NoTTYLogger
- type NonRetryableError
- type NoopLogger
- type PrefixedLogger
- type ProgressBarLogger
- type ProgressBarNoTTYLogger
- type ProgressLogger
- type Throttle
- type UILogger
- type UIPrefixWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BufferLogger ¶
type BufferLogger struct {
// contains filtered or unexported fields
}
BufferLogger write logs to a buffer
func NewBufferLogger ¶
func NewBufferLogger(buf *bytes.Buffer) *BufferLogger
NewBufferLogger creates a new BufferLogger
func (*BufferLogger) Logf ¶
func (b *BufferLogger) Logf(msg string, args ...interface{})
Logf writes log to the buffer
type LevelLogger ¶
type LevelLogger struct { LogLevel LogLevel // contains filtered or unexported fields }
LevelLogger allows specifying a log level to a ui.UI
func NewIndentedLevelLogger ¶
func NewIndentedLevelLogger(logger LoggerWithLevels) *LevelLogger
NewIndentedLevelLogger creates a new logger with levels and indented by 2 spaces
func NewNoopLevelLogger ¶
func NewNoopLevelLogger() *LevelLogger
NewNoopLevelLogger will not print anything
func NewUILevelLogger ¶
func NewUILevelLogger(level LogLevel, logger Logger) *LevelLogger
NewUILevelLogger is a LevelLogger constructor, wrapping a ui.UI with a specific log level
func (LevelLogger) Debugf ¶
func (l LevelLogger) Debugf(msg string, args ...interface{})
Debugf used to log debug related messages
func (LevelLogger) Errorf ¶
func (l LevelLogger) Errorf(msg string, args ...interface{})
Errorf used to log error related messages
func (LevelLogger) Level ¶
func (l LevelLogger) Level() LogLevel
Level retrieve the current log level for this logger
func (LevelLogger) Logf ¶
func (l LevelLogger) Logf(msg string, args ...interface{})
Logf logs the provided message
func (LevelLogger) Tracef ¶
func (l LevelLogger) Tracef(msg string, args ...interface{})
Tracef used to log trace related messages
func (LevelLogger) Warnf ¶
func (l LevelLogger) Warnf(msg string, args ...interface{})
Warnf used to log warning related messages
type LogLevelRetriever ¶
type LogLevelRetriever interface {
Level() LogLevel
}
LogLevelRetriever retrieves the log level
type Logger ¶
type Logger interface {
Logf(string, ...interface{})
}
Logger interface that defines the logger functions
type LoggerWithLevels ¶
type LoggerWithLevels interface { Errorf(msg string, args ...interface{}) Warnf(msg string, args ...interface{}) Debugf(msg string, args ...interface{}) Tracef(msg string, args ...interface{}) Logf(msg string, args ...interface{}) }
LoggerWithLevels wraps a ui.UI with logging levels
type NoTTYLogger ¶
type NoTTYLogger struct {
// contains filtered or unexported fields
}
NoTTYLogger struct that interacts with the UI. This logger allow writing to the UI when the tty is deactivated
func NewLoggerNoTTY ¶
func NewLoggerNoTTY(ui goui.UI) *NoTTYLogger
NewLoggerNoTTY creates a logger that will write even when tty is deactivated
func (*NoTTYLogger) Logf ¶
func (n *NoTTYLogger) Logf(msg string, args ...interface{})
Logf Prints log to UI when tty is deactivated
type NonRetryableError ¶
type NonRetryableError struct {
Message string
}
func (NonRetryableError) Error ¶
func (n NonRetryableError) Error() string
type PrefixedLogger ¶
type PrefixedLogger struct {
// contains filtered or unexported fields
}
PrefixedLogger Logger that attached a prefix to each line
func NewIndentedLogger ¶
func NewIndentedLogger(logger Logger) *PrefixedLogger
NewIndentedLogger creates a new logger indented by 2 spaces
func NewPrefixedLogger ¶
func NewPrefixedLogger(prefix string, logger Logger) *PrefixedLogger
NewPrefixedLogger constructor for building a UI with a prefix when logging a message
func (PrefixedLogger) Logf ¶
func (p PrefixedLogger) Logf(msg string, args ...interface{})
Logf logs message provided adds the prefix to each new line of the msg parameter
type ProgressBarLogger ¶
type ProgressBarLogger struct {
// contains filtered or unexported fields
}
ProgressBarLogger display progress bar on output
func (*ProgressBarLogger) End ¶
func (l *ProgressBarLogger) End()
End stops the progress bar and writes the final message
type ProgressBarNoTTYLogger ¶
type ProgressBarNoTTYLogger struct {
// contains filtered or unexported fields
}
ProgressBarNoTTYLogger does not display the progress bar
func (*ProgressBarNoTTYLogger) End ¶
func (l *ProgressBarNoTTYLogger) End()
End Write the final message
type ProgressLogger ¶
ProgressLogger Progress bar
func NewNoopProgressBar ¶
func NewNoopProgressBar() ProgressLogger
NewNoopProgressBar constructs a Noop Progress bar that will not display anything
func NewProgressBar ¶
func NewProgressBar(logger LoggerWithLevels, 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 ¶
type UILogger ¶
type UILogger struct {
// contains filtered or unexported fields
}
UILogger struct that interacts with the UI. This logger only writes to the UI when the tty is activated
type UIPrefixWriter ¶
UIPrefixWriter prints a prefix when the underlying ui prints a message
func (*UIPrefixWriter) BeginLinef ¶
func (w *UIPrefixWriter) BeginLinef(msg string, args ...interface{})
BeginLinef writes a message and args adding a configured prefix