log

package
v0.11.1-beta.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Discard = &DiscardLogger{}

Discard is a logger implementation that just discards every log statement

Functions

func PrintTable

func PrintTable(s Logger, header []string, values [][]string)

PrintTable prints a table with header columns and string values

func SetFakePrintTable

func SetFakePrintTable(fake func(s Logger, header []string, values [][]string))

SetFakePrintTable is a testing tool that allows overwriting the function PrintTable

func SetInstance

func SetInstance(logger Logger)

SetInstance sets the default logger instance

Types

type DiscardLogger

type DiscardLogger struct {
	PanicOnExit bool
}

DiscardLogger just discards every log statement

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) 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) Panic

func (d *DiscardLogger) Panic(args ...interface{})

Panic implements logger interface

func (*DiscardLogger) Panicf

func (d *DiscardLogger) Panicf(format string, args ...interface{})

Panicf 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) Write

func (d *DiscardLogger) Write(message []byte) (int, error)

Write implements logger interface

func (*DiscardLogger) WriteString

func (d *DiscardLogger) WriteString(message string)

WriteString implements logger interface

type Logger

type Logger interface {
	Debug(args ...interface{})
	Debugf(format string, args ...interface{})

	Info(args ...interface{})
	Infof(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{})

	Panic(args ...interface{})
	Panicf(format string, args ...interface{})

	Done(args ...interface{})
	Donef(format string, args ...interface{})

	Fail(args ...interface{})
	Failf(format string, args ...interface{})

	StartWait(message string)
	StopWait()

	Print(level logrus.Level, args ...interface{})
	Printf(level logrus.Level, format string, args ...interface{})

	Write(message []byte) (int, error)
	WriteString(message string)

	Question(params *survey.QuestionOptions) (string, error)

	SetLevel(level logrus.Level)
	GetLevel() logrus.Level
}

Logger defines the common logging interface

func GetInstance

func GetInstance() Logger

GetInstance returns the Logger instance

type StreamLogger

type StreamLogger struct {
	// contains filtered or unexported fields
}

StreamLogger logs all messages to a stream

func NewStreamLogger

func NewStreamLogger(stream io.Writer, level logrus.Level) *StreamLogger

NewStreamLogger creates a new stream logger

func (*StreamLogger) Debug

func (s *StreamLogger) Debug(args ...interface{})

Debug implements interface

func (*StreamLogger) Debugf

func (s *StreamLogger) Debugf(format string, args ...interface{})

Debugf implements interface

func (*StreamLogger) Done

func (s *StreamLogger) Done(args ...interface{})

Done implements interface

func (*StreamLogger) Donef

func (s *StreamLogger) Donef(format string, args ...interface{})

Donef implements interface

func (*StreamLogger) Error

func (s *StreamLogger) Error(args ...interface{})

Error implements interface

func (*StreamLogger) Errorf

func (s *StreamLogger) Errorf(format string, args ...interface{})

Errorf implements interface

func (*StreamLogger) Fail

func (s *StreamLogger) Fail(args ...interface{})

Fail implements interface

func (*StreamLogger) Failf

func (s *StreamLogger) Failf(format string, args ...interface{})

Failf implements interface

func (*StreamLogger) Fatal

func (s *StreamLogger) Fatal(args ...interface{})

Fatal implements interface

func (*StreamLogger) Fatalf

func (s *StreamLogger) Fatalf(format string, args ...interface{})

Fatalf implements interface

func (*StreamLogger) GetLevel

func (s *StreamLogger) GetLevel() logrus.Level

GetLevel implements interface

func (*StreamLogger) Info

func (s *StreamLogger) Info(args ...interface{})

Info implements interface

func (*StreamLogger) Infof

func (s *StreamLogger) Infof(format string, args ...interface{})

Infof implements interface

func (*StreamLogger) Panic

func (s *StreamLogger) Panic(args ...interface{})

Panic implements interface

func (*StreamLogger) Panicf

func (s *StreamLogger) Panicf(format string, args ...interface{})

Panicf implements interface

func (*StreamLogger) Print

func (s *StreamLogger) Print(level logrus.Level, args ...interface{})

Print implements interface

func (*StreamLogger) Printf

func (s *StreamLogger) Printf(level logrus.Level, format string, args ...interface{})

Printf implements interface

func (*StreamLogger) Question

func (s *StreamLogger) Question(params *survey.QuestionOptions) (string, error)

Question asks a new question

func (*StreamLogger) SetLevel

func (s *StreamLogger) SetLevel(level logrus.Level)

SetLevel implements interface

func (*StreamLogger) StartWait

func (s *StreamLogger) StartWait(message string)

StartWait prints a wait message until StopWait is called

func (*StreamLogger) StopWait

func (s *StreamLogger) StopWait()

StopWait prints a wait message until StopWait is called

func (*StreamLogger) Warn

func (s *StreamLogger) Warn(args ...interface{})

Warn implements interface

func (*StreamLogger) Warnf

func (s *StreamLogger) Warnf(format string, args ...interface{})

Warnf implements interface

func (*StreamLogger) Write

func (s *StreamLogger) Write(message []byte) (int, error)

func (*StreamLogger) WriteString

func (s *StreamLogger) WriteString(message string)

WriteString implements interface

type SurveyError

type SurveyError struct{}

SurveyError is used to identify errors where questions were asked in the discard logger

func (SurveyError) Error

func (s SurveyError) Error() string

Error implements error interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL