log

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CtxLogger

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

func NewCtxLogger

func NewCtxLogger(logLevel string, ctxKeys []string) *CtxLogger

NewCtxLogger returns a logger that will add context value to the log message

func NewCtxLoggerWithSaltLogger

func NewCtxLoggerWithSaltLogger(log saltLog.Logger, ctxKeys []string) *CtxLogger

NewCtxLoggerWithSaltLogger returns a logger that will add context value to the log message, wrapped with saltLog.Logger

func (*CtxLogger) Debug

func (l *CtxLogger) Debug(ctx context.Context, msg string, args ...interface{})

func (*CtxLogger) Error

func (l *CtxLogger) Error(ctx context.Context, msg string, args ...interface{})

func (*CtxLogger) Fatal

func (l *CtxLogger) Fatal(ctx context.Context, msg string, args ...interface{})

func (*CtxLogger) Info

func (l *CtxLogger) Info(ctx context.Context, msg string, args ...interface{})

func (*CtxLogger) Level

func (l *CtxLogger) Level() string

func (*CtxLogger) Warn

func (l *CtxLogger) Warn(ctx context.Context, msg string, args ...interface{})

func (*CtxLogger) Writer

func (l *CtxLogger) Writer() io.Writer

type Logger

type Logger interface {

	// Debug level message with alternating key/value pairs
	// key should be string, value could be anything printable
	Debug(ctx context.Context, msg string, args ...interface{})

	// Info level message with alternating key/value pairs
	// key should be string, value could be anything printable
	Info(ctx context.Context, msg string, args ...interface{})

	// Warn level message with alternating key/value pairs
	// key should be string, value could be anything printable
	Warn(ctx context.Context, msg string, args ...interface{})

	// Error level message with alternating key/value pairs
	// key should be string, value could be anything printable
	Error(ctx context.Context, msg string, args ...interface{})

	// Fatal level message with alternating key/value pairs
	// key should be string, value could be anything printable
	Fatal(ctx context.Context, msg string, args ...interface{})

	// Level returns priority level for which this logger will filter logs
	Level() string

	// Writer used to print logs
	Writer() io.Writer
}

type Noop

type Noop struct{}

func NewNoop

func NewNoop(opts ...Option) *Noop

NewNoop returns a no operation logger, useful in tests to avoid printing logs to stdout.

func (*Noop) Debug

func (n *Noop) Debug(ctx context.Context, msg string, args ...interface{})

func (*Noop) Error

func (n *Noop) Error(ctx context.Context, msg string, args ...interface{})

func (*Noop) Fatal

func (n *Noop) Fatal(ctx context.Context, msg string, args ...interface{})

func (*Noop) Info

func (n *Noop) Info(ctx context.Context, msg string, args ...interface{})

func (*Noop) Level

func (n *Noop) Level() string

func (*Noop) Warn

func (n *Noop) Warn(ctx context.Context, msg string, args ...interface{})

func (*Noop) Writer

func (n *Noop) Writer() io.Writer

type Option

type Option func(interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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