log

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: MPL-2.0 Imports: 20 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

View Source
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",
}
View Source
var Default = NewStdoutLogger(os.Stdin, stdout, stderr, logrus.InfoLevel)

Functions

func WithNopCloser

func WithNopCloser(writer io.Writer) io.WriteCloser

Types

type Format

type Format int
const (
	TextFormat Format = iota
	TimeFormat Format = iota
	JSONFormat Format = iota
	RawFormat  Format = iota
)

type Line

type Line struct {
	// Time is when this log message occurred
	Time time.Time `json:"time,omitempty"`

	// Message is when the message of the log message
	Message string `json:"message,omitempty"`

	// Level is the log level this message has used
	Level logrus.Level `json:"level,omitempty"`
}

type Logger

type Logger interface {
	log.Logger

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

	Writer(level logrus.Level, raw bool) io.WriteCloser
	WriteString(level logrus.Level, message string)
}

Logger defines the devspace common logging interface

func NewFileLogger

func NewFileLogger(logFile string, level logrus.Level) Logger

NewFileLogger returns a logger instance for the specified filename

type NopCloser

type NopCloser struct {
	io.Writer
}

func (NopCloser) Close

func (NopCloser) Close() error

type Prefix

type Prefix struct {
	Prefix string
	Color  string
}

type StreamLogger

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

func NewStdoutLogger

func NewStdoutLogger(stdin io.Reader, stdout, stderr io.Writer, level logrus.Level) *StreamLogger

func NewStreamLogger

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

func NewStreamLoggerWithFormat

func NewStreamLoggerWithFormat(stdout, stderr io.Writer, level logrus.Level, format Format) *StreamLogger

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

func (s *StreamLogger) JSON(level logrus.Level, value interface{})

func (*StreamLogger) MakeRaw

func (s *StreamLogger) MakeRaw()

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

func (s *StreamLogger) SetFormat(format Format)

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

func (s *StreamLogger) WithLevel(level logrus.Level) Logger

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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