Documentation ¶
Index ¶
- Constants
- Variables
- func AcquireGlobalSilence() (string, error)
- func OverrideRuntimeErrorHandler(discard bool)
- func PrintTable(s Logger, header []string, values [][]string)
- func PrintTableWithOptions(s Logger, header []string, values [][]string, ...)
- func ReleaseGlobalSilence(id string)
- func StartFileLogging()
- func WithNopCloser(writer io.Writer) io.WriteCloser
- type DiscardLogger
- func (d *DiscardLogger) AddSink(log Logger)
- func (d *DiscardLogger) Children() []Logger
- func (d *DiscardLogger) Debug(args ...interface{})
- func (d *DiscardLogger) Debugf(format string, args ...interface{})
- func (d *DiscardLogger) Done(args ...interface{})
- func (d *DiscardLogger) Donef(format string, args ...interface{})
- func (d *DiscardLogger) Error(args ...interface{})
- func (d *DiscardLogger) ErrorStreamOnly() Logger
- func (d *DiscardLogger) Errorf(format string, args ...interface{})
- func (d *DiscardLogger) Fail(args ...interface{})
- func (d *DiscardLogger) Failf(format string, args ...interface{})
- func (d *DiscardLogger) Fatal(args ...interface{})
- func (d *DiscardLogger) Fatalf(format string, args ...interface{})
- func (d *DiscardLogger) GetLevel() logrus.Level
- func (d *DiscardLogger) Info(args ...interface{})
- func (d *DiscardLogger) Infof(format string, args ...interface{})
- func (d *DiscardLogger) Print(level logrus.Level, args ...interface{})
- func (d *DiscardLogger) Printf(level logrus.Level, format string, args ...interface{})
- func (d *DiscardLogger) Question(params *survey.QuestionOptions) (string, error)
- func (d *DiscardLogger) SetLevel(level logrus.Level)
- func (d *DiscardLogger) StartWait(message string)
- func (d *DiscardLogger) StopWait()
- func (d *DiscardLogger) Warn(args ...interface{})
- func (d *DiscardLogger) Warnf(format string, args ...interface{})
- func (d *DiscardLogger) WithLevel(level logrus.Level) Logger
- func (d *DiscardLogger) WithPrefix(prefix string) Logger
- func (d *DiscardLogger) WithPrefixColor(prefix, color string) Logger
- func (d *DiscardLogger) WithSink(log Logger) Logger
- func (d *DiscardLogger) Write(message []byte) (int, error)
- func (d *DiscardLogger) WriteString(level logrus.Level, message string)
- func (d *DiscardLogger) Writer(level logrus.Level, raw bool) io.WriteCloser
- type Format
- type Line
- type Logger
- func GetBaseInstance() Logger
- func GetFileLogger(filename string) Logger
- func GetInstance() Logger
- func NewStdoutLogger(stdout, stderr io.Writer, level logrus.Level) Logger
- func NewStreamLogger(stdout, stderr io.Writer, level logrus.Level) Logger
- func NewStreamLoggerWithFormat(stdout, stderr io.Writer, level logrus.Level, format Format) Logger
- type NopCloser
- type Prefix
- type StreamLogger
- func (s *StreamLogger) AddSink(log Logger)
- func (s *StreamLogger) Children() []Logger
- func (s *StreamLogger) Debug(args ...interface{})
- func (s *StreamLogger) Debugf(format string, args ...interface{})
- func (s *StreamLogger) Done(args ...interface{})
- func (s *StreamLogger) Donef(format string, args ...interface{})
- func (s *StreamLogger) Error(args ...interface{})
- func (s *StreamLogger) ErrorStreamOnly() Logger
- func (s *StreamLogger) Errorf(format string, args ...interface{})
- func (s *StreamLogger) Fatal(args ...interface{})
- func (s *StreamLogger) Fatalf(format string, args ...interface{})
- func (s *StreamLogger) GetFormat() Format
- func (s *StreamLogger) GetLevel() logrus.Level
- func (s *StreamLogger) Info(args ...interface{})
- func (s *StreamLogger) Infof(format string, args ...interface{})
- func (s *StreamLogger) Print(level logrus.Level, args ...interface{})
- func (s *StreamLogger) Printf(level logrus.Level, format string, args ...interface{})
- func (s *StreamLogger) Question(params *survey.QuestionOptions) (string, error)
- func (s *StreamLogger) SetLevel(level logrus.Level)
- func (s *StreamLogger) Warn(args ...interface{})
- func (s *StreamLogger) Warnf(format string, args ...interface{})
- func (s *StreamLogger) WithLevel(level logrus.Level) Logger
- func (s *StreamLogger) WithPrefix(prefix string) Logger
- func (s *StreamLogger) WithPrefixColor(prefix, color string) Logger
- func (s *StreamLogger) WithSink(log Logger) Logger
- func (s *StreamLogger) WriteString(level logrus.Level, message string)
- func (s *StreamLogger) Writer(level logrus.Level, raw bool) io.WriteCloser
- type SurveyError
Constants ¶
const AnkorLogTimestamps = "ANKOR_LOG_TIMESTAMPS"
Variables ¶
var Colors = []string{
"blue",
"blue+h",
"blue+b",
"green",
"green+h",
"green+b",
"yellow",
"yellow+h",
"yellow+b",
"magenta",
"magenta+h",
"magenta+b",
"cyan",
"cyan+h",
"cyan+b",
"white",
"white+h",
"white+b",
}
var Discard = &DiscardLogger{}
Discard is a logger implementation that just discards every log statement
Functions ¶
func AcquireGlobalSilence ¶
func OverrideRuntimeErrorHandler ¶
func OverrideRuntimeErrorHandler(discard bool)
OverrideRuntimeErrorHandler overrides the standard runtime error handler that logs to stdout with a file logger that logs all runtime.HandleErrors to errors.log
func PrintTable ¶
func PrintTableWithOptions ¶
func PrintTableWithOptions(s Logger, header []string, values [][]string, modify func(table *tablewriter.Table))
PrintTableWithOptions prints a table with header columns and string values
func ReleaseGlobalSilence ¶
func ReleaseGlobalSilence(id string)
func StartFileLogging ¶
func StartFileLogging()
StartFileLogging logs the output of the global logger to the file default.log
func WithNopCloser ¶
func WithNopCloser(writer io.Writer) io.WriteCloser
Types ¶
type DiscardLogger ¶
type DiscardLogger struct{}
DiscardLogger just discards every log statement
func (*DiscardLogger) AddSink ¶
func (d *DiscardLogger) AddSink(log Logger)
func (*DiscardLogger) Children ¶
func (d *DiscardLogger) Children() []Logger
func (*DiscardLogger) Debug ¶
func (d *DiscardLogger) Debug(args ...interface{})
Debug implements logger interface
func (*DiscardLogger) Debugf ¶
func (d *DiscardLogger) Debugf(format string, args ...interface{})
Debugf implements logger interface
func (*DiscardLogger) Done ¶
func (d *DiscardLogger) Done(args ...interface{})
Done implements logger interface
func (*DiscardLogger) Donef ¶
func (d *DiscardLogger) Donef(format string, args ...interface{})
Donef implements logger interface
func (*DiscardLogger) Error ¶
func (d *DiscardLogger) Error(args ...interface{})
Error implements logger interface
func (*DiscardLogger) ErrorStreamOnly ¶
func (d *DiscardLogger) ErrorStreamOnly() Logger
func (*DiscardLogger) Errorf ¶
func (d *DiscardLogger) Errorf(format string, args ...interface{})
Errorf implements logger interface
func (*DiscardLogger) Fail ¶
func (d *DiscardLogger) Fail(args ...interface{})
Fail implements logger interface
func (*DiscardLogger) Failf ¶
func (d *DiscardLogger) Failf(format string, args ...interface{})
Failf implements logger interface
func (*DiscardLogger) Fatal ¶
func (d *DiscardLogger) Fatal(args ...interface{})
Fatal implements logger interface
func (*DiscardLogger) Fatalf ¶
func (d *DiscardLogger) Fatalf(format string, args ...interface{})
Fatalf implements logger interface
func (*DiscardLogger) GetLevel ¶
func (d *DiscardLogger) GetLevel() logrus.Level
GetLevel implements logger interface
func (*DiscardLogger) Info ¶
func (d *DiscardLogger) Info(args ...interface{})
Info implements logger interface
func (*DiscardLogger) Infof ¶
func (d *DiscardLogger) Infof(format string, args ...interface{})
Infof implements logger interface
func (*DiscardLogger) Print ¶
func (d *DiscardLogger) Print(level logrus.Level, args ...interface{})
Print implements logger interface
func (*DiscardLogger) Printf ¶
func (d *DiscardLogger) Printf(level logrus.Level, format string, args ...interface{})
Printf implements logger interface
func (*DiscardLogger) Question ¶
func (d *DiscardLogger) Question(params *survey.QuestionOptions) (string, error)
Question asks a new question
func (*DiscardLogger) SetLevel ¶
func (d *DiscardLogger) SetLevel(level logrus.Level)
SetLevel implements logger interface
func (*DiscardLogger) StartWait ¶
func (d *DiscardLogger) StartWait(message string)
StartWait implements logger interface
func (*DiscardLogger) StopWait ¶
func (d *DiscardLogger) StopWait()
StopWait implements logger interface
func (*DiscardLogger) Warn ¶
func (d *DiscardLogger) Warn(args ...interface{})
Warn implements logger interface
func (*DiscardLogger) Warnf ¶
func (d *DiscardLogger) Warnf(format string, args ...interface{})
Warnf implements logger interface
func (*DiscardLogger) WithLevel ¶
func (d *DiscardLogger) WithLevel(level logrus.Level) Logger
WithLevel implements logger interface
func (*DiscardLogger) WithPrefix ¶
func (d *DiscardLogger) WithPrefix(prefix string) Logger
func (*DiscardLogger) WithPrefixColor ¶
func (d *DiscardLogger) WithPrefixColor(prefix, color string) Logger
func (*DiscardLogger) WithSink ¶
func (d *DiscardLogger) WithSink(log Logger) Logger
func (*DiscardLogger) Write ¶
func (d *DiscardLogger) Write(message []byte) (int, error)
Write implements logger interface
func (*DiscardLogger) WriteString ¶
func (d *DiscardLogger) WriteString(level logrus.Level, message string)
WriteString implements logger interface
func (*DiscardLogger) Writer ¶
func (d *DiscardLogger) Writer(level logrus.Level, raw bool) io.WriteCloser
type Logger ¶
type Logger interface { Debug(args ...interface{}) Debugf(format string, args ...interface{}) Info(args ...interface{}) Infof(format string, args ...interface{}) Done(args ...interface{}) Donef(format string, args ...interface{}) Warn(args ...interface{}) Warnf(format string, args ...interface{}) Error(args ...interface{}) Errorf(format string, args ...interface{}) Fatal(args ...interface{}) Fatalf(format string, args ...interface{}) Print(level logrus.Level, args ...interface{}) Printf(level logrus.Level, format string, args ...interface{}) Writer(level logrus.Level, raw bool) io.WriteCloser WriteString(level logrus.Level, message string) Question(params *survey.QuestionOptions) (string, error) SetLevel(level logrus.Level) GetLevel() logrus.Level // WithLevel creates a new logger with the given level WithLevel(level logrus.Level) Logger ErrorStreamOnly() Logger WithPrefix(prefix string) Logger WithPrefixColor(prefix, color string) Logger WithSink(sink Logger) Logger AddSink(sink Logger) }
Logger defines the common logging interface
func GetFileLogger ¶
GetFileLogger returns a logger instance for the specified filename
type StreamLogger ¶
type StreamLogger struct {
// contains filtered or unexported fields
}
func (*StreamLogger) AddSink ¶
func (s *StreamLogger) AddSink(log Logger)
func (*StreamLogger) Children ¶
func (s *StreamLogger) Children() []Logger
func (*StreamLogger) Debug ¶
func (s *StreamLogger) Debug(args ...interface{})
func (*StreamLogger) Debugf ¶
func (s *StreamLogger) Debugf(format string, args ...interface{})
func (*StreamLogger) Done ¶
func (s *StreamLogger) Done(args ...interface{})
func (*StreamLogger) Donef ¶
func (s *StreamLogger) Donef(format string, args ...interface{})
func (*StreamLogger) Error ¶
func (s *StreamLogger) Error(args ...interface{})
func (*StreamLogger) ErrorStreamOnly ¶
func (s *StreamLogger) ErrorStreamOnly() Logger
func (*StreamLogger) Errorf ¶
func (s *StreamLogger) Errorf(format string, args ...interface{})
func (*StreamLogger) Fatal ¶
func (s *StreamLogger) Fatal(args ...interface{})
func (*StreamLogger) Fatalf ¶
func (s *StreamLogger) Fatalf(format string, args ...interface{})
func (*StreamLogger) GetFormat ¶
func (s *StreamLogger) GetFormat() Format
func (*StreamLogger) GetLevel ¶
func (s *StreamLogger) GetLevel() logrus.Level
func (*StreamLogger) Info ¶
func (s *StreamLogger) Info(args ...interface{})
func (*StreamLogger) Infof ¶
func (s *StreamLogger) Infof(format string, args ...interface{})
func (*StreamLogger) Print ¶
func (s *StreamLogger) Print(level logrus.Level, args ...interface{})
func (*StreamLogger) Printf ¶
func (s *StreamLogger) Printf(level logrus.Level, format string, args ...interface{})
func (*StreamLogger) Question ¶
func (s *StreamLogger) Question(params *survey.QuestionOptions) (string, error)
func (*StreamLogger) SetLevel ¶
func (s *StreamLogger) SetLevel(level logrus.Level)
func (*StreamLogger) Warn ¶
func (s *StreamLogger) Warn(args ...interface{})
func (*StreamLogger) Warnf ¶
func (s *StreamLogger) Warnf(format string, args ...interface{})
func (*StreamLogger) WithPrefix ¶
func (s *StreamLogger) WithPrefix(prefix string) Logger
func (*StreamLogger) WithPrefixColor ¶
func (s *StreamLogger) WithPrefixColor(prefix, color string) Logger
func (*StreamLogger) WithSink ¶
func (s *StreamLogger) WithSink(log Logger) Logger
func (*StreamLogger) WriteString ¶
func (s *StreamLogger) WriteString(level logrus.Level, message string)
func (*StreamLogger) Writer ¶
func (s *StreamLogger) Writer(level logrus.Level, raw bool) io.WriteCloser
type SurveyError ¶
type SurveyError struct{}
SurveyError is used to identify errors where questions were asked in the discard logger