zap

package
v0.0.0-...-7eb9a9b Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

@Title 请填写文件名称(需要改) @Description 请填写文件描述(需要改) @Author 请填写自己的真是姓名(需要改) 2021/6/27 0:06 @Update 请填写自己的真是姓名(需要改) 2021/6/27 0:06

@Title zap配置 @Description 请填写文件描述(需要改) @Author 请填写自己的真是姓名(需要改) 2021/6/30 12:24 @Update 请填写自己的真是姓名(需要改) 2021/6/30 12:24

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomTimeEncoder

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

自定义日志输出时间格式

func GetWriteSyncer

func GetWriteSyncer() (zapcore.WriteSyncer, error)

@author: [SliverHorn](https://github.com/SliverHorn) @function: GetWriteSyncer @description: zap logger中加入file-rotatelogs @return: zapcore.WriteSyncer, error

func InitZap

func InitZap(zapConfig ZapConfig) (logger *zap.Logger)

Types

type ZapConfig

type ZapConfig struct {
	Level         string `mapstructure:"level" json:"level" yaml:"level"`                           // 级别
	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:"showLine"`                 // 显示行
	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"`  // 输出控制台
}

Jump to

Keyboard shortcuts

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