Documentation
¶
Index ¶
- func GetDetails(err error) []any
- func Smprintf(f string, args ...any) string
- func WithDetails(err error, args ...any) error
- type ActionFlag
- type DetailedError
- type Interface
- type Level
- type Logger
- func (l *Logger) Debug(fmt string, args ...any)
- func (l *Logger) Err(err error, args ...any)
- func (l *Logger) Error(fmt string, args ...any)
- func (l *Logger) Info(fmt string, args ...any)
- func (l *Logger) MarkAction(key string, outcome Outcome)
- func (l *Logger) Output(level Level) io.Writer
- func (l *Logger) StartAction(key, desc string, flags ...ActionFlag)
- func (l *Logger) TickAction(key string)
- func (l *Logger) Warn(fmt string, args ...any)
- func (l *Logger) With(args ...any) Interface
- type LowLevelLogger
- type Outcome
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDetails ¶
func WithDetails ¶
Types ¶
type ActionFlag ¶
type ActionFlag string
ActionFlag provides additional flags for actions
const ( // None is not a flag. None ActionFlag = "none" // Spinning requests a manually ticked spinner. Spinning ActionFlag = "spin" // AutoSpinning requests an automatically ticked spinner. AutoSpinning ActionFlag = "auto-spin" // Plain requests that the log line be printed without spinners, outcomes, // etc. Just the message itself. Plain ActionFlag = "plain" )
type DetailedError ¶
type DetailedError interface {
Details() []any
}
type Interface ¶
type Interface interface {
Debug(line string, fields ...any)
Info(line string, fields ...any)
Warn(line string, fields ...any)
Error(line string, fields ...any)
Err(err error, fields ...any)
With(args ...any) Interface
StartAction(key, desc string, flags ...ActionFlag)
TickAction(key string)
MarkAction(key string, outcome Outcome)
Output(level Level) io.Writer
}
Interface is the logging interface that is provided to both the plugin logging system and the master logging system.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is provided to plugins to allow them to interact with the parent task in a standard way. Other language implementations can mimic the behavior here to achieve the same results. Under the hood is just a structured logging system passing information back to the master process via tagged values.
func (*Logger) Err ¶
Err logs the given error as an error log. It will add any details attached to the log (via the log.WithDetails interface) as additional arguments.
func (*Logger) MarkAction ¶
MarkAction logs the original message with the given outcome.
func (*Logger) Output ¶
Output returns an io.Writer that can be used to write to the given log level.
func (*Logger) StartAction ¶
func (l *Logger) StartAction(key, desc string, flags ...ActionFlag)
StartAction logs the given message, but marks the action as being a progress item that has a followup. You may pass zero or more ActionFlags to mark this action as having additional features. Currently, flags include:
log.None - no-op flag log.Spin - request a manually ticked spinner log.AutoSpin - request an automatically ticked spinner log.Plain - just the message, no spinners, outcomes, etc.
func (*Logger) TickAction ¶
TickAction logs the original message again, but is intended to be used to make a spinner move a tick.