Documentation
¶
Index ¶
- type Level
- type Logger
- func (l *Logger) Debug(format string, args ...any)
- func (l *Logger) Error(format string, args ...any)
- func (l *Logger) Level() Level
- func (l *Logger) Progress(format string, args ...any)
- func (l *Logger) StepDone(elapsed time.Duration)
- func (l *Logger) StepSkip(reason string)
- func (l *Logger) StepStart(label string)
- func (l *Logger) Warn(format string, args ...any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Level ¶ added in v1.11.0
type Level int
Level controls which messages a Logger emits. Higher values are more verbose.
const ( // LevelError emits only errors. LevelError Level // LevelWarn emits errors and warnings. LevelWarn // LevelInfo emits errors, warnings, and progress/step messages. Default. LevelInfo // LevelDebug emits everything including detailed diagnostic logs. LevelDebug )
func ParseLevel ¶ added in v1.11.0
ParseLevel parses a case-insensitive level string ("error", "warn", "info", "debug"). Returns false if the string is unrecognised.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger handles leveled output to stderr. Logging format:
2006-01-02 15:04:05 [scanning] message — progress (info+) 2006-01-02 15:04:05 [warning] message — warnings (warn+) 2006-01-02 15:04:05 [error] message — errors (error+) 2006-01-02 15:04:05 [debug] message — diagnostics (debug only) ⠋ label... (Xms) — spinner animation (info+) ✓ label (Xms) — step done (info+) ○ label (skipped) — step skipped (info+)
func NewNoop ¶
func NewNoop() *Logger
NewNoop returns a Logger that suppresses all output, including errors.
func (*Logger) Debug ¶ added in v1.11.0
Debug prints a diagnostic message to stderr when level >= debug. Format: [debug] message
func (*Logger) Error ¶
Error prints an error to stderr when level >= error (i.e. unless noop). Format: [error] message
func (*Logger) Progress ¶
Progress prints a progress message to stderr when level >= info. Format: [scanning] message