progress

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: EUPL-1.2 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

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

Context wraps a Logger and guards against nil receiver.

func NewContext

func NewContext(logger Logger) *Context

NewContext wraps a Logger. Passing nil produces a no-op context.

func (*Context) Debugf

func (c *Context) Debugf(format string, args ...any)

Debugf logs a debug message

func (*Context) Logf

func (c *Context) Logf(format string, args ...any)

Logf logs a message

func (*Context) Warningf

func (c *Context) Warningf(format string, args ...any)

Warningf logs a warning

type Logger

type Logger interface {
	Logf(format string, args ...any)
	Warningf(format string, args ...any)
	Debugf(format string, args ...any)
}

Logger is the minimal interface for progress and verbose logging implementations.

type NoopLogger

type NoopLogger struct{}

NoopLogger discards all output. Used as the default when no progress is desired.

func (*NoopLogger) Debugf

func (nl *NoopLogger) Debugf(format string, args ...any)

func (*NoopLogger) Logf

func (nl *NoopLogger) Logf(format string, args ...any)

func (*NoopLogger) SetArticleCount

func (nl *NoopLogger) SetArticleCount(total, processed int)

func (*NoopLogger) SetStage

func (nl *NoopLogger) SetStage(stage string)

func (*NoopLogger) SetSubStage

func (nl *NoopLogger) SetSubStage(status string)

func (*NoopLogger) SetTokenEstimate

func (nl *NoopLogger) SetTokenEstimate(total, used int)

func (*NoopLogger) StartWaiting

func (nl *NoopLogger) StartWaiting()

func (*NoopLogger) Warningf

func (nl *NoopLogger) Warningf(format string, args ...any)

type Progress

type Progress interface {
	Logger
	SetStage(stage string)
	SetSubStage(status string)
	SetArticleCount(total, processed int)
	SetTokenEstimate(total, used int)
	StartWaiting()
}

Progress extends Logger with stage/count/timing reporting. Implementations: NoopLogger (no output), SimpleLogger (stdout), TUIProgress (tea messages).

type SimpleLogger

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

SimpleLogger writes formatted output to an io.Writer.

func NewSimpleLogger

func NewSimpleLogger(writer io.Writer, debug bool) *SimpleLogger

NewSimpleLogger creates a SimpleLogger; set debug=true to enable Debugf output.

func (*SimpleLogger) Debugf

func (sl *SimpleLogger) Debugf(format string, args ...any)

func (*SimpleLogger) Logf

func (sl *SimpleLogger) Logf(format string, args ...any)

func (*SimpleLogger) SetArticleCount

func (sl *SimpleLogger) SetArticleCount(total, processed int)

func (*SimpleLogger) SetStage

func (sl *SimpleLogger) SetStage(stage string)

func (*SimpleLogger) SetSubStage

func (sl *SimpleLogger) SetSubStage(stage string)

func (*SimpleLogger) SetTokenEstimate

func (sl *SimpleLogger) SetTokenEstimate(total, used int)

func (*SimpleLogger) StartWaiting

func (sl *SimpleLogger) StartWaiting()

func (*SimpleLogger) Warningf

func (sl *SimpleLogger) Warningf(format string, args ...any)

Jump to

Keyboard shortcuts

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