log

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultLevel    = "info"
	DefaultEncoding = HumanizeEncoding
)

Variables

View Source
var (
	DefaultConfigs = Configs{
		Level:    DefaultLevel,
		Encoding: DefaultEncoding,
	}
)

Functions

func HumanizeTimeEncoder

func HumanizeTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)

func NewLogger

func NewLogger(c Configs) (*zap.Logger, error)

Types

type Configs

type Configs struct {
	Level          string
	Encoding       EncodingType
	ServiceContext *ServiceContext
}

type EncodingType

type EncodingType string
const (
	JSONEncoding     EncodingType = "json"
	ConsoleEncoding  EncodingType = "console"
	HumanizeEncoding EncodingType = "humanize"
)

type ServiceContext

type ServiceContext struct {
	Service string
	Version string
}

func (ServiceContext) MarshalLogObject

func (sc ServiceContext) MarshalLogObject(enc zapcore.ObjectEncoder) error

Jump to

Keyboard shortcuts

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