Documentation
¶
Index ¶
- Variables
- type Buffered
- func (l *Buffered) AddFixedLine() Logger
- func (l *Buffered) Close()
- func (l *Buffered) Errorf(format string, a ...interface{}) Logger
- func (l *Buffered) Fatalf(format string, a ...interface{})
- func (l *Buffered) Infof(format string, a ...interface{}) Logger
- func (l *Buffered) MinLevel() Level
- func (l *Buffered) Printf(level Level, format string, a ...interface{}) Logger
- func (l *Buffered) Progressf(format string, a ...interface{}) Logger
- func (l *Buffered) RootLogger() Logger
- func (l *Buffered) SetMinLevel(level Level) Logger
- func (l *Buffered) Verbosef(format string, a ...interface{}) Logger
- func (l *Buffered) Warningf(format string, a ...interface{}) Logger
- type Config
- type FixedLine
- func (l *FixedLine) AddFixedLine() Logger
- func (l *FixedLine) Close()
- func (l *FixedLine) Errorf(format string, a ...interface{}) Logger
- func (l *FixedLine) Fatalf(format string, a ...interface{})
- func (l *FixedLine) Infof(format string, a ...interface{}) Logger
- func (l *FixedLine) MinLevel() Level
- func (l *FixedLine) Printf(level Level, format string, a ...interface{}) Logger
- func (l *FixedLine) Progressf(format string, a ...interface{}) Logger
- func (l *FixedLine) RootLogger() Logger
- func (l *FixedLine) SetMinLevel(level Level) Logger
- func (l *FixedLine) Verbosef(format string, a ...interface{}) Logger
- func (l *FixedLine) Warningf(format string, a ...interface{}) Logger
- type Level
- type Logger
- type Msg
- type MsgType
- type Printer
Constants ¶
This section is empty.
Variables ¶
var IsNoColorSet = false
Functions ¶
This section is empty.
Types ¶
type Buffered ¶
type Buffered struct {
// contains filtered or unexported fields
}
func NewBuffered ¶
func (*Buffered) AddFixedLine ¶
AddFixedLine creates a Logger that, when connected to a terminal, draws over itself. Thread safe.
func (*Buffered) Close ¶
func (l *Buffered) Close()
Close should be called before the app exits, to ensure any buffered output is flushed. Thread safe.
func (*Buffered) RootLogger ¶
func (*Buffered) SetMinLevel ¶
type FixedLine ¶
type FixedLine struct {
// contains filtered or unexported fields
}
FixedLine is a Logger that attempts to overwrite the same line in the terminal, allowing progress bars and other simple UI for the human to consume.
If the Printer's CanUseAnsi is false, then it simply redirects to the normal behavior of the parent Buffered Logger.
If the Printer's CanUseAnsi is true, then the Progress level is always printed, regardless of the MinLevel. This allows progress bars that do not pollute logs with garbage when not connected to a terminal.
func (*FixedLine) AddFixedLine ¶
func (*FixedLine) RootLogger ¶
func (*FixedLine) SetMinLevel ¶
type Logger ¶
type Logger interface {
// Close should be called before the process ends, to ensure everything is flushed.
Close()
// RootLogger returns the parent Logger, or itself if it has no parent.
RootLogger() Logger
// AddFixedLine creates a logger that always overwrites the same terminal line,
// and always writes line level Progress.
// Returned Logger should have its Close() called before its parent.
AddFixedLine() Logger
// MinLevel returns the lowest Level that will be logged.
MinLevel() Level
// SetMinLevel sets the lowest Level that will be logged.
SetMinLevel(level Level) Logger
// Printf is how log lines are added.
Printf(level Level, format string, a ...interface{}) Logger
Progressf(format string, a ...interface{}) Logger
Verbosef(format string, a ...interface{}) Logger
Infof(format string, a ...interface{}) Logger
Warningf(format string, a ...interface{}) Logger
Errorf(format string, a ...interface{}) Logger
Fatalf(format string, a ...interface{})
}