log

package
v0.45.4-rc2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 3 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 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