logger

package
v0.0.0-...-4692f6a Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: MIT Imports: 3 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DevelopmentLevel = "development"
	ProductionLevel  = "production"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Level string
}

Config is a struct to configure logger

func (*Config) GetLevel

func (l *Config) GetLevel() string

GetLevel returns the level of the logger

type Field

type Field = zapcore.Field

func Array

func Array(key string, val zapcore.ArrayMarshaler) Field

func Duration

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

func Error

func Error(v error) Field

func Float64

func Float64(key string, val float64) Field

func Int

func Int(k string, i int) Field

func Int64

func Int64(k string, i int64) Field

func Object

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

func String

func String(k, v string) Field

func Time

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

type Logger

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

func New

func New(cfg Config) Logger

func NewDevelopmentLogger

func NewDevelopmentLogger() (Logger, error)

func NewNopLogger

func NewNopLogger() (Logger, error)

func NewProductionLogger

func NewProductionLogger() (Logger, error)

type ObjectEncoder

type ObjectEncoder = zapcore.ObjectEncoder

Jump to

Keyboard shortcuts

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