output

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debugf

func Debugf(s string, args ...any)

func Debugln

func Debugln(s any)

func Errorf

func Errorf(s string, args ...any)

func Errorln

func Errorln(s any)

func Fatalf

func Fatalf(s string, args ...any) error

Fatalf is the equivalent of Errorf except it returns a basic error to signal the command has failed

func Fatalln

func Fatalln(s any) error

Fatalln is the equivalent of Errorln except it returns a basic error to signal the command has failed

func FormatBytes

func FormatBytes(i int64) string

func Infof

func Infof(s string, args ...any)

func Infoln

func Infoln(s any)

func Logf

func Logf(level LogLevel, s string, args ...any)

func Logln

func Logln(level LogLevel, s any)

func NewDownloadProgress

func NewDownloadProgress() (*DownloadProgressBar, *ProgressLogger)

func ProgressEnabled

func ProgressEnabled() bool

func SafeDebugf

func SafeDebugf(s string, args ...any)

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 SafeLogf

func SafeLogf(level LogLevel, s string, args ...any)

func SafeLogln

func SafeLogln(level LogLevel, s any)

func SetErr

func SetErr(w io.Writer)

func SetLogLevel

func SetLogLevel(level LogLevel)

func SetLogLevelFromString

func SetLogLevelFromString(level string) error

func SetOut

func SetOut(w io.Writer)

func SetProgressBars

func SetProgressBars(style string)

func SystemInfof

func SystemInfof(s string, args ...any)

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 WrapClient

func WrapClient(c remote.Client) remote.Client

WrapClient returns a remote.Client that logs every request at a 'trace' level. If the currently set logging level would not print 'trace' logs, this is a no-op.

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 LogLevel

type LogLevel int
const (
	LogLevelTrace LogLevel = iota
	LogLevelDebug
	LogLevelInfo
	LogLevelWarn
	LogLevelError
)

type LoggingClient

type LoggingClient struct {
	remote.Client
}

func (*LoggingClient) Do

func (c *LoggingClient) Do(req *http.Request) (*http.Response, error)

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.

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) Logf

func (pw *ProgressLogger) Logf(level LogLevel, s string, args ...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) Write

func (t *ProgressTar) Write(b []byte) (int, 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()

func (*PullProgress) ProxyWriter

func (p *PullProgress) ProxyWriter(w io.Writer, digest string, size, offset int64) io.Writer

Jump to

Keyboard shortcuts

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