logger

package
v4.29.8 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 License: MIT Imports: 10 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 ...interface{})

Debug logs debug message

func Error

func Error(format string, a ...interface{})

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 ...interface{})

Info logs info message

func Trace

func Trace(format string, a ...interface{})

Trace logs tracing message

func Warn

func Warn(format string, a ...interface{})

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 WithField added in v4.7.1

func WithField(name string, value interface{}) FieldsContext

WithField create context for logging

func (FieldsContext) Debug added in v4.7.0

func (f FieldsContext) Debug(format string, a ...interface{})

Debug logs debug message

func (FieldsContext) Error added in v4.7.0

func (f FieldsContext) Error(format string, a ...interface{})

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 ...interface{})

Info logs info message

func (FieldsContext) Trace added in v4.7.0

func (f FieldsContext) Trace(format string, a ...interface{})

Trace logs tracing message

func (FieldsContext) Warn added in v4.7.0

func (f FieldsContext) Warn(format string, a ...interface{})

Warn logs warning message

func (FieldsContext) WithField added in v4.7.0

func (f FieldsContext) WithField(name string, value interface{}) FieldsContext

WithField add a field to current context

type Logger

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

Logger defines a logger instance

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 ...interface{})

Debug logs debug message

func (Logger) Debugf added in v4.20.0

func (l Logger) Debugf(format string, a ...interface{})

Debugf logs debug message

func (Logger) Error

func (l Logger) Error(format string, a ...interface{})

Error logs error message

func (Logger) Errorf added in v4.20.0

func (l Logger) Errorf(format string, a ...interface{})

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 ...interface{})

Info logs info message

func (Logger) Infof added in v4.20.0

func (l Logger) Infof(format string, a ...interface{})

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 ...interface{})

Trace logs tracing message

func (Logger) Warn

func (l Logger) Warn(format string, a ...interface{})

Warn logs warning message

func (Logger) Warningf added in v4.20.0

func (l Logger) Warningf(format string, a ...interface{})

Warningf logs warning message

func (Logger) WithField added in v4.7.0

func (l Logger) WithField(name string, value interface{}) FieldsContext

WithField add given name and value to a context

type Provider added in v4.29.2

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

Provider definition

Jump to

Keyboard shortcuts

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