Help us shape the future of Go! Take the 2026 Go Developer Survey

log

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

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 BaseLogger

type BaseLogger 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{})

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

	LogrLogSink() logr.LogSink
}

BaseLogger defines the common logging interface

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"`

	// Fields are the fields of the log message
	Fields logrus.Fields `json:"fields,omitempty"`
}

type Logger

type Logger interface {
	BaseLogger

	WithFields(fields logrus.Fields) Logger

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

	Writer(level logrus.Level, raw bool) io.WriteCloser
	WriteString(level logrus.Level, message string)
	WriteLevel(level logrus.Level, message []byte) (int, error)
}

Logger defines the devspace common logging interface

func GetInstance

func GetInstance() Logger

func NewDiscardLogger

func NewDiscardLogger(level logrus.Level) Logger

NewDiscardLogger returns a logger instance for the

func NewFileLogger

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

NewFileLogger returns a logger instance for the specified filename

func WithFields

func WithFields(fields logrus.Fields) Logger

WithFields creates a new logger with the given fields

type NopCloser

type NopCloser struct {
	io.Writer
}

func (NopCloser) Close

func (NopCloser) Close() error

type Prefix

type Prefix struct {
	Prefix string
	Color  string
}

type SimpleLogger

type SimpleLogger interface {
	Infof(format string, args ...interface{})
}

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

func (s *StreamLogger) LogrLogSink() logr.LogSink

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

func (s *StreamLogger) WithFields(fields logrus.Fields) Logger

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

func (s *StreamLogger) WriteLevel(level logrus.Level, message []byte) (int, error)

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
zapr
Package zapr defines an implementation of the github.com/go-logr/logr interfaces built on top of Zap (go.uber.org/zap).
Package zapr defines an implementation of the github.com/go-logr/logr interfaces built on top of Zap (go.uber.org/zap).

Jump to

Keyboard shortcuts

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