logging

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: MIT Imports: 4 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLogger = NewNopLogger()

DefaultLogger is the default logger.

Functions

This section is empty.

Types

type Field

type Field = zapcore.Field

Field is the logger field.

func Duration

func Duration(k string, d time.Duration) Field

Duration appends a duration field.

func Error

func Error(v error) Field

Error appends an error field.

func Float64

func Float64(key string, val float64) Field

Float64 appends a float64 field.

func Int

func Int(k string, i int) Field

Int appends an int field.

func Int64

func Int64(k string, i int64) Field

Int64 appends an int64 field.

func Object

func Object(key string, val zapcore.ObjectMarshaler) Field

Object appends an object field with implements ObjectMarshaler interface.

func String

func String(k, v string) Field

String appends a string field.

func Time

func Time(key string, val time.Time) Field

Time appends a time field.

type Logger

type Logger interface {
	Panic(context.Context, string, ...Field)
	Info(context.Context, string, ...Field)
	Error(context.Context, string, ...Field)
	Debug(context.Context, string, ...Field)
	Sync() error
	With(fields ...Field) Logger
}

Logger is the standart logger interface.

func NewDevelopmentLogger

func NewDevelopmentLogger() (Logger, error)

NewDevelopmentLogger initializes a development logger.

func NewNopLogger

func NewNopLogger() Logger

NewNopLogger initializes a noop logger.

func NewProductionLogger

func NewProductionLogger() (Logger, error)

NewProductionLogger initializes a production logger.

type ObjectEncoder

type ObjectEncoder = zapcore.ObjectEncoder

ObjectEncoder is the logger representation of a structure.

Jump to

Keyboard shortcuts

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