log

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: BSD-2-Clause Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLevel added in v1.2.9

func SetLevel(level LogLevel)

Types

type DefaultLogger

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

DefaultLogger is the logger used when no other is specified.

func NewDefaultLogger

func NewDefaultLogger() *DefaultLogger

NewDefaultLogger creates the default logger with settings found in the process environment.

func (*DefaultLogger) Begin

func (dl *DefaultLogger) Begin(ctx context.Context, f string)

Begin writes a default log at the begining of a function.

func (*DefaultLogger) Errorf

func (dl *DefaultLogger) Errorf(ctx context.Context, s string, args ...interface{})

Errorf is used for errorf at info level.

func (*DefaultLogger) Infof

func (dl *DefaultLogger) Infof(ctx context.Context, s string, args ...interface{})

Infof is used for logging at info level.

func (*DefaultLogger) Warningf

func (dl *DefaultLogger) Warningf(ctx context.Context, s string, args ...interface{})

Warningf is used for warning at info level.

type Klog added in v1.2.9

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

func (*Klog) Begin added in v1.2.9

func (kl *Klog) Begin(ctx context.Context, f string)

Begin writes a default log at the begining of a function.

func (*Klog) Errorf added in v1.2.9

func (kl *Klog) Errorf(ctx context.Context, s string, args ...interface{})

Errorf is used for logging at error level.

func (*Klog) Infof added in v1.2.9

func (kl *Klog) Infof(ctx context.Context, s string, args ...interface{})

Infof is used for logging at info level.

func (*Klog) SetLogLevel added in v1.2.9

func (kl *Klog) SetLogLevel(level LogLevel)

func (*Klog) Warningf added in v1.2.9

func (kl *Klog) Warningf(ctx context.Context, s string, args ...interface{})

Warningf is used for logging at warning level.

type LogLevel added in v1.2.9

type LogLevel string
const (
	DebugLevel   LogLevel = "DEBUG"
	InfoLevel    LogLevel = "INFO"
	WarningLevel LogLevel = "WARNING"
	ErrorLevel   LogLevel = "ERROR"
	NoneLevel    LogLevel = "NONE"
)

type Logger

type Logger interface {
	Begin(ctx context.Context, f string)
	Infof(ctx context.Context, s string, args ...interface{})
	Warningf(ctx context.Context, s string, args ...interface{})
	Errorf(ctx context.Context, s string, args ...interface{})
	SetLogLevel(level LogLevel)
}

Logger defines all methods required by an logger.

func NewKlogLogger added in v1.2.9

func NewKlogLogger(printLogLevel LogLevel) (Logger, error)

NewKlog returns a new instance of a wrapper around klog. If printLogLevel is set to WARNING or ERROR the logger only prints only logs with the corresponding level or higher. If printLogLevel is set to NONE the logger prints no logs.

func NewNoLogger added in v1.2.9

func NewNoLogger() (Logger, error)

NewKlog returns a new instance of a wrapper around klog. If printLogLevel is set to WARNING or ERROR the logger only prints only logs with the corresponding level or higher. If printLogLevel is set to NONE the logger prints no logs.

func NewZerologger added in v1.2.9

func NewZerologger() (Logger, error)

type Nolog added in v1.2.9

type Nolog struct{}

func (*Nolog) Begin added in v1.2.9

func (l *Nolog) Begin(ctx context.Context, f string)

Begin writes a default log at the begining of a function.

func (*Nolog) Errorf added in v1.2.9

func (l *Nolog) Errorf(ctx context.Context, s string, args ...interface{})

Errorf is used for logging at error level.

func (*Nolog) Infof added in v1.2.9

func (l *Nolog) Infof(ctx context.Context, s string, args ...interface{})

Infof is used for logging at info level.

func (*Nolog) SetLogLevel added in v1.2.9

func (l *Nolog) SetLogLevel(ll LogLevel)

func (*Nolog) Warningf added in v1.2.9

func (l *Nolog) Warningf(ctx context.Context, s string, args ...interface{})

Warningf is used for logging at warning level.

type Zerolog added in v1.2.9

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

func (*Zerolog) Begin added in v1.2.9

func (l *Zerolog) Begin(ctx context.Context, f string)

Begin writes a default log at the begining of a function.

func (*Zerolog) Errorf added in v1.2.9

func (l *Zerolog) Errorf(ctx context.Context, s string, args ...interface{})

Errorf is used for logging at error level.

func (*Zerolog) Infof added in v1.2.9

func (l *Zerolog) Infof(ctx context.Context, s string, args ...interface{})

Infof is used for logging at info level.

func (*Zerolog) SetLogLevel added in v1.2.9

func (l *Zerolog) SetLogLevel(ll LogLevel)

func (*Zerolog) Warningf added in v1.2.9

func (l *Zerolog) Warningf(ctx context.Context, s string, args ...interface{})

Warningf is used for logging at warning level.

Jump to

Keyboard shortcuts

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