logger

package
v4.11.5 Latest Latest
Warning

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

Go to latest
Published: May 23, 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 EscapeString

func EscapeString(content string) string

EscapeString escapes value from raw string to be JSON compatible

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

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) Error

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

Error 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) 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) WithField added in v4.7.0

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

WithField add given name and value to a context

Jump to

Keyboard shortcuts

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