Documentation
¶
Index ¶
- func Debugf(s string, args ...any)
- func Debugln(s ...any)
- func Errorf(s string, args ...any)
- func Errorln(s ...any)
- func Fatalf(s string, args ...any) error
- func Fatalln(s ...any) error
- func FormatBytes(i int64) string
- func GetErr() io.Writer
- func GetOut() io.Writer
- func Infof(s string, args ...any)
- func Infoln(s ...any)
- func Logf(level LogLevel, s string, args ...any)
- func Logln(level LogLevel, s ...any)
- func NewDownloadProgress() (*DownloadProgressBar, *ProgressLogger)
- func ProgressEnabled() bool
- func SafeDebugf(s string, args ...any)
- func SafeDebugln(s ...any)
- func SafeLogf(level LogLevel, s string, args ...any)
- func SafeLogln(level LogLevel, s ...any)
- func SetErr(w io.Writer)
- func SetLogLevel(level LogLevel)
- func SetLogLevelFromString(level string) error
- func SetLogger(l Logger)
- func SetOut(w io.Writer)
- func SetProgressBars(style string)
- func SystemInfof(s string, args ...any)
- func SystemInfoln(s ...any)
- func TarProgress(total int64, tw *tar.Writer) (*ProgressTar, *ProgressLogger)
- func WrapHTTPTransport(rt http.RoundTripper) http.RoundTripper
- type DownloadProgressBar
- type LogLevel
- type Logger
- type LoggingTransport
- type ProgressBar
- type ProgressLogger
- func (pw *ProgressLogger) Debugf(s string, args ...any)
- func (pw *ProgressLogger) Debugln(s ...any)
- func (pw *ProgressLogger) Infof(s string, args ...any)
- func (pw *ProgressLogger) Infoln(s ...any)
- func (pw *ProgressLogger) Logf(level LogLevel, s string, args ...any)
- func (pw *ProgressLogger) Logln(level LogLevel, s ...any)
- func (pw *ProgressLogger) Wait()
- type ProgressTar
- type PullProgress
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fatalf ¶
Fatalf is the equivalent of Errorf except it returns a basic error to signal the command has failed
func Fatalln ¶
Fatalln is the equivalent of Errorln except it returns a basic error to signal the command has failed
func FormatBytes ¶
func NewDownloadProgress ¶
func NewDownloadProgress() (*DownloadProgressBar, *ProgressLogger)
func ProgressEnabled ¶
func ProgressEnabled() bool
func SafeDebugf ¶
SafeDebugf is the same as Debugf except it will only print if progress bars are disabled to avoid confusing output
func SafeDebugln ¶
func SafeDebugln(s ...any)
SafeDebugln is the same as Debugln except it will only print if progress bars are disabled to avoid confusing output
func SetLogLevel ¶
func SetLogLevel(level LogLevel)
func SetLogLevelFromString ¶
func SetLogger ¶ added in v1.12.0
func SetLogger(l Logger)
SetLogger replaces the default logger. All package-level log functions (Logln, Logf, Errorln, etc.) will delegate to l. ProgressLogger output is not routed through l — it writes directly to the progress bar writer to avoid corrupting terminal output. Callers who set a custom logger should also call SetProgressBars("none") to disable progress bars.
func SetProgressBars ¶
func SetProgressBars(style string)
func SystemInfof ¶
SystemInfof is like Infof except it logs to stderr. This should be used for system messages such as update notifications
func SystemInfoln ¶
func SystemInfoln(s ...any)
SystemInfoln is like Infoln except it logs to stderr. This should be used for system messages such as update notifications
func TarProgress ¶
func TarProgress(total int64, tw *tar.Writer) (*ProgressTar, *ProgressLogger)
func WrapHTTPTransport ¶ added in v1.11.0
func WrapHTTPTransport(rt http.RoundTripper) http.RoundTripper
Types ¶
type DownloadProgressBar ¶
type DownloadProgressBar struct {
// contains filtered or unexported fields
}
func (*DownloadProgressBar) Done ¶
func (pb *DownloadProgressBar) Done()
func (*DownloadProgressBar) TrackDownload ¶
func (pb *DownloadProgressBar) TrackDownload(rc io.ReadCloser, name string, totalSize int64) io.ReadCloser
type Logger ¶ added in v1.12.0
Logger receives all log output. Embedders implement this to redirect logs. When set via SetLogger, Kit bypasses its own level filtering and formatting — the Logger controls both. format+args follow fmt.Sprintf conventions and are passed through unformatted.
type LoggingTransport ¶ added in v1.11.0
type LoggingTransport struct {
http.RoundTripper
}
type ProgressBar ¶
type ProgressBar struct {
// contains filtered or unexported fields
}
func GenericProgressBar ¶
func GenericProgressBar(name, doneMsg string, total int64) *ProgressBar
func (*ProgressBar) Done ¶
func (b *ProgressBar) Done()
func (*ProgressBar) Increment ¶
func (b *ProgressBar) Increment()
type ProgressLogger ¶
type ProgressLogger struct {
// contains filtered or unexported fields
}
ProgressLogger allows for printing info and debug lines while a progress bar is filling, and should be used instead of the standard output functions to prevent progress bars from removing log lines. Once the progress bar is done, the Wait() method should be called.
Note: ProgressLogger writes directly to its underlying writer (typically an mpb.Progress instance) and does not route through a custom Logger set via SetLogger. This is necessary to coordinate output with active progress bars.
func WrapTarget ¶
func WrapTarget(wrap oras.Target) (oras.Target, *ProgressLogger)
WrapTarget wraps an oras.Target so that calls to Push print a progress bar. If output is configured to not print progress bars, this is a no-op.
func WrapUnpackReadCloser ¶
func WrapUnpackReadCloser(size int64, rc io.ReadCloser) (io.ReadCloser, *ProgressLogger)
func (*ProgressLogger) Debugf ¶
func (pw *ProgressLogger) Debugf(s string, args ...any)
func (*ProgressLogger) Debugln ¶
func (pw *ProgressLogger) Debugln(s ...any)
func (*ProgressLogger) Infof ¶
func (pw *ProgressLogger) Infof(s string, args ...any)
func (*ProgressLogger) Infoln ¶
func (pw *ProgressLogger) Infoln(s ...any)
func (*ProgressLogger) Logln ¶
func (pw *ProgressLogger) Logln(level LogLevel, s ...any)
func (*ProgressLogger) Wait ¶
func (pw *ProgressLogger) Wait()
Wait will call Wait() on the underlying mpb.Progress, if present. Otherwise, this is a no-op.
type ProgressTar ¶
type ProgressTar struct {
// contains filtered or unexported fields
}
func (*ProgressTar) Close ¶
func (t *ProgressTar) Close() error
func (*ProgressTar) WriteHeader ¶
func (t *ProgressTar) WriteHeader(hdr *tar.Header) error
type PullProgress ¶
type PullProgress struct {
ProgressLogger
// contains filtered or unexported fields
}
func NewPullProgress ¶
func NewPullProgress(ctx context.Context) *PullProgress
func (*PullProgress) Done ¶
func (p *PullProgress) Done()