logger

package
v4.44.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MIT Imports: 11 Imported by: 31

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

Close ends logger gracefully

func Debug

func Debug(format string, a ...any)

Debug logs debug message

func Error

func Error(format string, a ...any)

Error logs error message

func Fatal

func Fatal(err error)

Fatal logs error message and exit with status code 1

func Global

func Global(l Logger)

Global sets global logger

func Info

func Info(format string, a ...any)

Info logs info message

func Trace

func Trace(format string, a ...any)

Trace logs tracing message

func Warn

func Warn(format string, a ...any)

Warn logs warning message

func WriteEscapedJSON added in v4.22.4

func WriteEscapedJSON(content string, output *bytes.Buffer)

WriteEscapedJSON escapes value from raw string to be JSON compatible

Types

type Config

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

Config of package

func Flags

func Flags(fs *flag.FlagSet, prefix string, overrides ...flags.Override) Config

Flags adds flags for configuring package

type FieldsContext added in v4.7.0

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

FieldsContext contains field context

func (FieldsContext) Debug added in v4.7.0

func (f FieldsContext) Debug(format string, a ...any)

Debug logs debug message

func (FieldsContext) Error added in v4.7.0

func (f FieldsContext) Error(format string, a ...any)

Error logs error message

func (FieldsContext) Fatal added in v4.7.0

func (f FieldsContext) Fatal(err error)

Fatal logs error message and exit with status code 1

func (FieldsContext) Info added in v4.7.0

func (f FieldsContext) Info(format string, a ...any)

Info logs info message

func (FieldsContext) Trace added in v4.7.0

func (f FieldsContext) Trace(format string, a ...any)

Trace logs tracing message

func (FieldsContext) Warn added in v4.7.0

func (f FieldsContext) Warn(format string, a ...any)

Warn logs warning message

func (FieldsContext) WithField added in v4.7.0

func (f FieldsContext) WithField(name string, value any) Provider

WithField add a field to current context

type Logger

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

Logger defines a logger instance

func GetGlobal added in v4.37.0

func GetGlobal() Logger

GetGlobal returns global logger

func New

func New(config Config) Logger

New creates a Logger

func (Logger) Close

func (l Logger) Close()

Close ends logger gracefully

func (Logger) Debug

func (l Logger) Debug(format string, a ...any)

Debug logs debug message

func (Logger) Debugf added in v4.20.0

func (l Logger) Debugf(format string, a ...any)

Debugf logs debug message

func (Logger) Error

func (l Logger) Error(format string, a ...any)

Error logs error message

func (Logger) Errorf added in v4.20.0

func (l Logger) Errorf(format string, a ...any)

Errorf logs error message

func (Logger) Fatal

func (l Logger) Fatal(err error)

Fatal logs error message and exit with status code 1

func (Logger) Info

func (l Logger) Info(format string, a ...any)

Info logs info message

func (Logger) Infof added in v4.20.0

func (l Logger) Infof(format string, a ...any)

Infof logs info message

func (Logger) Start

func (l Logger) Start()

Start starts logger's writer

func (Logger) Trace

func (l Logger) Trace(format string, a ...any)

Trace logs tracing message

func (Logger) Warn

func (l Logger) Warn(format string, a ...any)

Warn logs warning message

func (Logger) Warningf added in v4.20.0

func (l Logger) Warningf(format string, a ...any)

Warningf logs warning message

func (Logger) WithField added in v4.7.0

func (l Logger) WithField(name string, value any) Provider

WithField add given name and value to a context

type Provider added in v4.29.2

type Provider interface {
	WithField(name string, value any) Provider
	Trace(format string, a ...any)
	Debug(format string, a ...any)
	Info(format string, a ...any)
	Warn(format string, a ...any)
	Error(format string, a ...any)
	Fatal(err error)
}

Provider of logging definition

func WithField added in v4.7.1

func WithField(name string, value any) Provider

WithField create context for logging

Jump to

Keyboard shortcuts

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