Documentation ¶
Index ¶
- Constants
- func Deprecation(ctx context.Context, key string, message string)
- func Error(ctx context.Context, status string)
- func Errorf(ctx context.Context, status string, args ...any)
- func Flush(ctx context.Context)
- func Info(ctx context.Context, status string)
- func InfoFallback(ctx context.Context, status string)
- func InfoFallbackf(ctx context.Context, status string, args ...any)
- func Infof(ctx context.Context, status string, args ...any)
- func IsTraceEnabled(ctx context.Context) bool
- func NewContext(ctx context.Context, slh StatusHandler) context.Context
- func Trace(ctx context.Context, status string)
- func Tracef(ctx context.Context, status string, args ...any)
- func Warning(ctx context.Context, status string)
- func WarningOnce(ctx context.Context, key string, status string)
- func WarningOncef(ctx context.Context, key string, status string, args ...any)
- func Warningf(ctx context.Context, status string, args ...any)
- type EndResult
- type Level
- type LineRedirector
- type MultiLineStatusHandler
- func (s *MultiLineStatusHandler) Flush()
- func (s *MultiLineStatusHandler) IsTraceEnabled() bool
- func (s *MultiLineStatusHandler) Message(level Level, message string)
- func (s *MultiLineStatusHandler) MessageFallback(level Level, message string)
- func (s *MultiLineStatusHandler) SetTrace(trace bool)
- func (s *MultiLineStatusHandler) StartStatus(level Level, total int, message string) StatusLine
- func (s *MultiLineStatusHandler) Stop()
- type NoopStatusHandler
- func (n NoopStatusHandler) Flush()
- func (n NoopStatusHandler) IsTerminal() bool
- func (n NoopStatusHandler) IsTraceEnabled() bool
- func (n NoopStatusHandler) Message(level Level, message string)
- func (n NoopStatusHandler) MessageFallback(level Level, message string)
- func (n NoopStatusHandler) SetTrace(trace bool)
- func (n NoopStatusHandler) StartStatus(level Level, total int, message string) StatusLine
- func (n NoopStatusHandler) Stop()
- type NoopStatusLine
- type Option
- type StatusContext
- func (s *StatusContext) Failed()
- func (s *StatusContext) FailedWithMessage(msg string)
- func (s *StatusContext) FailedWithMessagef(msg string, args ...any)
- func (s *StatusContext) Increment()
- func (s *StatusContext) InfoFallback(message string)
- func (s *StatusContext) InfoFallbackf(message string, args ...any)
- func (s *StatusContext) SetTotal(total int)
- func (s *StatusContext) Success()
- func (s *StatusContext) Update(message string)
- func (s *StatusContext) UpdateAndInfoFallback(message string)
- func (s *StatusContext) UpdateAndInfoFallbackf(message string, args ...any)
- func (s *StatusContext) Updatef(message string, args ...any)
- func (s *StatusContext) Warning()
- type StatusHandler
- type StatusLine
Constants ¶
View Source
const ( LevelTrace = iota LevelInfo LevelWarning LevelError LevelProgress LevelPrompt )
Variables ¶
This section is empty.
Functions ¶
func Deprecation ¶ added in v2.15.0
func InfoFallback ¶
func InfoFallbackf ¶ added in v2.20.8
func IsTraceEnabled ¶ added in v2.13.0
func NewContext ¶
func NewContext(ctx context.Context, slh StatusHandler) context.Context
func WarningOnce ¶ added in v2.16.0
func WarningOncef ¶ added in v2.20.8
Types ¶
type LineRedirector ¶ added in v2.22.0
type LineRedirector struct { io.WriteCloser // contains filtered or unexported fields }
func NewLineRedirector ¶
func NewLineRedirector(cb func(line string)) *LineRedirector
func (*LineRedirector) Close ¶ added in v2.22.0
func (lr *LineRedirector) Close() error
func (*LineRedirector) Done ¶ added in v2.22.0
func (lr *LineRedirector) Done() <-chan struct{}
type MultiLineStatusHandler ¶
type MultiLineStatusHandler struct {
// contains filtered or unexported fields
}
func (*MultiLineStatusHandler) Flush ¶ added in v2.11.2
func (s *MultiLineStatusHandler) Flush()
func (*MultiLineStatusHandler) IsTraceEnabled ¶ added in v2.13.0
func (s *MultiLineStatusHandler) IsTraceEnabled() bool
func (*MultiLineStatusHandler) Message ¶ added in v2.21.0
func (s *MultiLineStatusHandler) Message(level Level, message string)
func (*MultiLineStatusHandler) MessageFallback ¶ added in v2.21.0
func (s *MultiLineStatusHandler) MessageFallback(level Level, message string)
func (*MultiLineStatusHandler) SetTrace ¶ added in v2.10.1
func (s *MultiLineStatusHandler) SetTrace(trace bool)
func (*MultiLineStatusHandler) StartStatus ¶
func (s *MultiLineStatusHandler) StartStatus(level Level, total int, message string) StatusLine
func (*MultiLineStatusHandler) Stop ¶
func (s *MultiLineStatusHandler) Stop()
type NoopStatusHandler ¶ added in v2.11.0
type NoopStatusHandler struct { }
func (NoopStatusHandler) Flush ¶ added in v2.11.2
func (n NoopStatusHandler) Flush()
func (NoopStatusHandler) IsTerminal ¶ added in v2.12.4
func (n NoopStatusHandler) IsTerminal() bool
func (NoopStatusHandler) IsTraceEnabled ¶ added in v2.13.0
func (n NoopStatusHandler) IsTraceEnabled() bool
func (NoopStatusHandler) Message ¶ added in v2.21.0
func (n NoopStatusHandler) Message(level Level, message string)
func (NoopStatusHandler) MessageFallback ¶ added in v2.21.0
func (n NoopStatusHandler) MessageFallback(level Level, message string)
func (NoopStatusHandler) SetTrace ¶ added in v2.11.0
func (n NoopStatusHandler) SetTrace(trace bool)
func (NoopStatusHandler) StartStatus ¶ added in v2.11.0
func (n NoopStatusHandler) StartStatus(level Level, total int, message string) StatusLine
func (NoopStatusHandler) Stop ¶ added in v2.11.0
func (n NoopStatusHandler) Stop()
type NoopStatusLine ¶ added in v2.11.0
type NoopStatusLine struct { }
func (NoopStatusLine) End ¶ added in v2.11.0
func (n NoopStatusLine) End(result EndResult)
func (NoopStatusLine) Increment ¶ added in v2.11.0
func (n NoopStatusLine) Increment()
func (NoopStatusLine) SetTotal ¶ added in v2.11.0
func (n NoopStatusLine) SetTotal(total int)
func (NoopStatusLine) Update ¶ added in v2.11.0
func (n NoopStatusLine) Update(message string)
type Option ¶
type Option func(s *StatusContext)
func WithPrefix ¶
func WithStatus ¶
func WithStatusf ¶ added in v2.20.8
type StatusContext ¶
type StatusContext struct {
// contains filtered or unexported fields
}
StatusContext is used to report user-facing status/progress
func StartWithOptions ¶
func StartWithOptions(ctx context.Context, opts ...Option) *StatusContext
func Startf ¶ added in v2.20.8
func Startf(ctx context.Context, status string, args ...any) *StatusContext
func (*StatusContext) Failed ¶
func (s *StatusContext) Failed()
func (*StatusContext) FailedWithMessage ¶
func (s *StatusContext) FailedWithMessage(msg string)
func (*StatusContext) FailedWithMessagef ¶ added in v2.20.8
func (s *StatusContext) FailedWithMessagef(msg string, args ...any)
func (*StatusContext) Increment ¶
func (s *StatusContext) Increment()
func (*StatusContext) InfoFallback ¶
func (s *StatusContext) InfoFallback(message string)
func (*StatusContext) InfoFallbackf ¶ added in v2.20.8
func (s *StatusContext) InfoFallbackf(message string, args ...any)
func (*StatusContext) SetTotal ¶
func (s *StatusContext) SetTotal(total int)
func (*StatusContext) Success ¶
func (s *StatusContext) Success()
func (*StatusContext) Update ¶
func (s *StatusContext) Update(message string)
func (*StatusContext) UpdateAndInfoFallback ¶
func (s *StatusContext) UpdateAndInfoFallback(message string)
func (*StatusContext) UpdateAndInfoFallbackf ¶ added in v2.20.8
func (s *StatusContext) UpdateAndInfoFallbackf(message string, args ...any)
func (*StatusContext) Updatef ¶ added in v2.20.8
func (s *StatusContext) Updatef(message string, args ...any)
func (*StatusContext) Warning ¶
func (s *StatusContext) Warning()
type StatusHandler ¶
type StatusHandler interface { IsTraceEnabled() bool Stop() Flush() StartStatus(level Level, total int, message string) StatusLine Message(level Level, message string) MessageFallback(level Level, message string) }
func FromContext ¶
func FromContext(ctx context.Context) StatusHandler
func NewSimpleStatusHandler ¶
func NewSimpleStatusHandler(cb func(level Level, message string), trace bool) StatusHandler
type StatusLine ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.