logger

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GlobalLogLevel = 1

	Log = New()
)

Functions

func EnableGroupSession

func EnableGroupSession(logger interface{}) func()

Types

type Colors

type Colors struct {
	Info  color.Attribute
	Error color.Attribute
	Key   color.Attribute
}

type GroupedLogger

type GroupedLogger interface {
	Grouped(state bool)
}

type Logger

type Logger interface {
	Enabled() bool
	Info(msg string, keysAndValues ...interface{})
	Error(err error, msg string, keysAndValues ...interface{})
	V(level int) Logger
	WithValues(keysAndValues ...interface{}) Logger
	WithName(name string) Logger

	GetLogrLogger() logr.Logger
}

func New

func New(options ...Option) Logger

func NewWithLogrLogger

func NewWithLogrLogger(logger logr.Logger) Logger

type LogrAdapter

type LogrAdapter struct {
	logr.Logger
}

func (*LogrAdapter) GetLogrLogger

func (log *LogrAdapter) GetLogrLogger() logr.Logger

func (*LogrAdapter) V

func (log *LogrAdapter) V(level int) Logger

func (*LogrAdapter) WithName

func (log *LogrAdapter) WithName(name string) Logger

func (*LogrAdapter) WithValues

func (log *LogrAdapter) WithValues(keysAndValues ...interface{}) Logger

type Option

type Option func(*SpinnerLogSink)

func CheckMarkCharacter

func CheckMarkCharacter(m rune) Option

func Color

func Color(colors Colors) Option

func Err

func Err(w io.Writer) Option

func ErrorMarkCharacter

func ErrorMarkCharacter(m rune) Option

func Grouppable

func Grouppable() Option

func Out

func Out(w io.Writer) Option

func SeparatorCharacter

func SeparatorCharacter(m rune) Option

func Truncate

func Truncate() Option

func WithName

func WithName(name string) Option

func WithTime

func WithTime(format string) Option

type SpinnerLogSink

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

func NewSpinnerLogSink

func NewSpinnerLogSink(options ...Option) *SpinnerLogSink

func (*SpinnerLogSink) AddName

func (log *SpinnerLogSink) AddName(name string)

func (*SpinnerLogSink) AddValues

func (log *SpinnerLogSink) AddValues(keyAndValues []interface{})

func (*SpinnerLogSink) Copy

func (log *SpinnerLogSink) Copy() *SpinnerLogSink

func (*SpinnerLogSink) Enabled

func (log *SpinnerLogSink) Enabled(level int) bool

Enabled implements logr.LogSink interface

func (*SpinnerLogSink) Error

func (log *SpinnerLogSink) Error(e error, msg string, keysAndValues ...interface{})

Error implements logr.LogSink interface

func (*SpinnerLogSink) GetGrouppable

func (log *SpinnerLogSink) GetGrouppable() bool

func (*SpinnerLogSink) GetShowTime

func (log *SpinnerLogSink) GetShowTime() bool

func (*SpinnerLogSink) GetSpinner

func (log *SpinnerLogSink) GetSpinner() *spinner.Spinner

func (*SpinnerLogSink) GetValues

func (log *SpinnerLogSink) GetValues() []interface{}

func (*SpinnerLogSink) Grouped

func (log *SpinnerLogSink) Grouped(state bool)

func (*SpinnerLogSink) Info

func (log *SpinnerLogSink) Info(level int, msg string, keysAndValues ...interface{})

Info implements logr.LogSink interface

func (*SpinnerLogSink) Init

func (log *SpinnerLogSink) Init(_ logr.RuntimeInfo)

func (*SpinnerLogSink) InitSpinner

func (log *SpinnerLogSink) InitSpinner()

func (*SpinnerLogSink) SetDisableColor

func (log *SpinnerLogSink) SetDisableColor(disableColor bool)

func (*SpinnerLogSink) SetGrouppable

func (log *SpinnerLogSink) SetGrouppable(state bool)

func (*SpinnerLogSink) SetOptions

func (log *SpinnerLogSink) SetOptions(options ...Option)

func (*SpinnerLogSink) SetShowTime

func (log *SpinnerLogSink) SetShowTime(time bool)

func (*SpinnerLogSink) ShowTime

func (log *SpinnerLogSink) ShowTime(f bool) *SpinnerLogSink

func (*SpinnerLogSink) StopSpinner

func (log *SpinnerLogSink) StopSpinner()

func (*SpinnerLogSink) WithName

func (log *SpinnerLogSink) WithName(name string) logr.LogSink

WithName implements logr.LogSink interface

func (*SpinnerLogSink) WithValues

func (log *SpinnerLogSink) WithValues(keysAndValues ...interface{}) logr.LogSink

WithValues implements logr.LogSink interface

Jump to

Keyboard shortcuts

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