logger

package
v0.0.0-...-e7f08e9 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Development      bool   `default:"true"`
	EnableCaller     bool   `default:"false" split_words:"true"`
	EnableStacktrace bool   `default:"false" split_words:"true"`
	Encoding         string `default:"console"`
	Level            string `default:"warn"`
}

Config is the configs needed for logging purposes.

type Field

type Field struct {
	Key   string
	Value interface{}
	Type  FieldType
}

func Any

func Any(key string, val interface{}) Field

Any constructs a field with the given key and value.

func Error

func Error(val error) Field

Error constructs a field with the given key and value.

func Float64

func Float64(key string, val float64) Field

Float constructs a field with the given key and value.

func Int

func Int(key string, val int) Field

Int constructs a field with the given key and value.

func String

func String(key string, val string) Field

String constructs a field with the given key and value.

type FieldType

type FieldType uint8
const (
	UnknownType FieldType = iota
	BoolType
	IntType
	Float64Type
	StringType
	ErrorType
)

type Logger

type Logger interface {
	Debug(string, ...Field)
	Info(string, ...Field)
	Warn(string, ...Field)
	Error(string, ...Field)
	Panic(string, ...Field)
	Fatal(string, ...Field)
}

func NewZap

func NewZap(cfg *Config) Logger

Jump to

Keyboard shortcuts

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