_zap

package
v0.0.0-...-77e6e3b Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomTimeEncoder

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

自定义日志输出时间格式

func GetEncoderConfig

func GetEncoderConfig() (config zapcore.EncoderConfig)

getEncoderConfig 获取zapcore.EncoderConfig

func GetEncoderCore

func GetEncoderCore(level zapcore.Level) (core zapcore.Core)

getEncoderCore 获取Encoder的zapcore.Core

func GetWriteSyncer

func GetWriteSyncer() (zapcore.WriteSyncer, error)

GetWriteSyncer zap logger中加入file-rotatelogs

func Strings

func Strings(key string, ss [][]string) zap.Field

Strings constructs a field that carries a slice of strings.

Types

type StringsArray

type StringsArray [][]string

func (StringsArray) MarshalLogArray

func (ss StringsArray) MarshalLogArray(arr zapcore.ArrayEncoder) error

MarshalLogArray 序列化数组日志

type Zap

type Zap struct {
	Level         string `mapstructure:"level" json:"level" yaml:"level"` //debug ,info,warn,error,panic,fatal
	Format        string `mapstructure:"format" json:"format" yaml:"format"`
	Prefix        string `mapstructure:"prefix" json:"prefix" yaml:"prefix"`
	Director      string `mapstructure:"director" json:"director"  yaml:"director"`
	LinkName      string `mapstructure:"link-name" json:"linkName" yaml:"link-name"`
	ShowLine      bool   `mapstructure:"show-line" json:"showLine" yaml:"show-line"`
	EncodeLevel   string `mapstructure:"encode-level" json:"encodeLevel" yaml:"encode-level"`
	StacktraceKey string `mapstructure:"stacktrace-key" json:"stacktraceKey" yaml:"stacktrace-key"`
	LogInConsole  bool   `mapstructure:"log-in-console" json:"logInConsole" yaml:"log-in-console"`
}
var (
	ZapInst Zap
)

Jump to

Keyboard shortcuts

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