Documentation ¶
Overview ¶
Package util contains internal utility tools used in imgpkg
Index ¶
- func BuildDefaultUploadTagRef(item WithDigest, importRepo regname.Repository) (regname.Tag, error)
- func Retry(doFunc func() error) error
- type BufferLogger
- type DefaultTagGenerator
- 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 RepoBasedTagGenerator
- type TagGenDigest
- type TagGenerator
- type Throttle
- type UILogger
- type UIPrefixWriter
- type WithDigest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildDefaultUploadTagRef ¶
func BuildDefaultUploadTagRef(item WithDigest, importRepo regname.Repository) (regname.Tag, error)
BuildDefaultUploadTagRef Builds a tag from the digest Algorithm and Digest
Types ¶
type BufferLogger ¶ added in v0.31.0
type BufferLogger struct {
// contains filtered or unexported fields
}
BufferLogger write logs to a buffer
func NewBufferLogger ¶ added in v0.31.0
func NewBufferLogger(buf *bytes.Buffer) *BufferLogger
NewBufferLogger creates a new BufferLogger
func (*BufferLogger) Logf ¶ added in v0.31.0
func (b *BufferLogger) Logf(msg string, args ...interface{})
Logf writes log to the buffer
type DefaultTagGenerator ¶ added in v0.28.0
type DefaultTagGenerator struct{}
DefaultTagGenerator implements GenerateTag and generates default tag
func (DefaultTagGenerator) GenerateTag ¶ added in v0.28.0
func (tagGen DefaultTagGenerator) GenerateTag(item imagedigest.DigestWrap, importRepo regname.Repository) (regname.Tag, error)
GenerateTag generates default tag
type LevelLogger ¶ added in v0.31.0
type LevelLogger struct { LogLevel LogLevel // contains filtered or unexported fields }
LevelLogger allows specifying a log level to a ui.UI
func NewIndentedLevelLogger ¶ added in v0.31.0
func NewIndentedLevelLogger(logger LoggerWithLevels) *LevelLogger
NewIndentedLevelLogger creates a new logger with levels and indented by 2 spaces
func NewNoopLevelLogger ¶ added in v0.31.0
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 ¶ added in v0.31.0
func (l LevelLogger) Debugf(msg string, args ...interface{})
Debugf used to log debug related messages
func (LevelLogger) Errorf ¶ added in v0.31.0
func (l LevelLogger) Errorf(msg string, args ...interface{})
Errorf used to log error related messages
func (LevelLogger) Level ¶ added in v0.31.0
func (l LevelLogger) Level() LogLevel
Level retrieve the current log level for this logger
func (LevelLogger) Logf ¶ added in v0.31.0
func (l LevelLogger) Logf(msg string, args ...interface{})
Logf logs the provided message
func (LevelLogger) Tracef ¶ added in v0.31.0
func (l LevelLogger) Tracef(msg string, args ...interface{})
Tracef used to log trace related messages
func (LevelLogger) Warnf ¶ added in v0.31.0
func (l LevelLogger) Warnf(msg string, args ...interface{})
Warnf used to log warning related messages
type LogLevelRetriever ¶ added in v0.31.0
type LogLevelRetriever interface {
Level() LogLevel
}
LogLevelRetriever retrieves the log level
type Logger ¶ added in v0.31.0
type Logger interface {
Logf(string, ...interface{})
}
Logger interface that defines the logger functions
type LoggerWithLevels ¶ added in v0.31.0
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 ¶ added in v0.31.0
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 ¶ added in v0.31.0
func NewLoggerNoTTY(ui goui.UI) *NoTTYLogger
NewLoggerNoTTY creates a logger that will write even when tty is deactivated
func (*NoTTYLogger) Logf ¶ added in v0.31.0
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 NoopLogger ¶ added in v0.31.0
type NoopLogger struct{}
NoopLogger this logger will not print
func NewNoopLogger ¶ added in v0.31.0
func NewNoopLogger() *NoopLogger
NewNoopLogger creates a new noop logger
func (NoopLogger) Logf ¶ added in v0.31.0
func (n NoopLogger) Logf(string, ...interface{})
Logf does nothing
type PrefixedLogger ¶ added in v0.31.0
type PrefixedLogger struct {
// contains filtered or unexported fields
}
PrefixedLogger Logger that attached a prefix to each line
func NewIndentedLogger ¶ added in v0.31.0
func NewIndentedLogger(logger Logger) *PrefixedLogger
NewIndentedLogger creates a new logger indented by 2 spaces
func NewPrefixedLogger ¶ added in v0.31.0
func NewPrefixedLogger(prefix string, logger Logger) *PrefixedLogger
NewPrefixedLogger constructor for building a UI with a prefix when logging a message
func (PrefixedLogger) Logf ¶ added in v0.31.0
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 ¶ added in v0.31.0
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 RepoBasedTagGenerator ¶ added in v0.28.0
type RepoBasedTagGenerator struct{}
RepoBasedTagGenerator implements GenerateTag and generates repo-based tag
func (RepoBasedTagGenerator) GenerateTag ¶ added in v0.28.0
func (tagGen RepoBasedTagGenerator) GenerateTag(item imagedigest.DigestWrap, importRepo regname.Repository) (regname.Tag, error)
GenerateTag generates repo-based tags
type TagGenDigest ¶ added in v0.28.0
TagGenDigest contains Algorithm and Hex values of image digest
type TagGenerator ¶ added in v0.28.0
type TagGenerator interface {
GenerateTag(item imagedigest.DigestWrap, destinationRepo regname.Repository) (regname.Tag, error)
}
TagGenerator interface
type Throttle ¶
type Throttle struct {
// contains filtered or unexported fields
}
func NewThrottle ¶
type UILogger ¶ added in v0.31.0
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
type WithDigest ¶
WithDigest are items that Digest() can be called on