log

package module
v0.0.0-...-a7ad40d Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2021 License: MIT Imports: 9 Imported by: 0

README

log

介绍

zap封装的一个简单的日志记录

软件架构

zap、gin

使用说明
  1. log.Init(appName)
  2. gin.Use(log.GinLogger)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(ctx context.Context, format string, a ...interface{})

func Default

func Default(appName string)

Default default logger

func Error

func Error(ctx context.Context, format string, a ...interface{})

func GinLogger

func GinLogger() gin.HandlerFunc

GinLogger gin Logger

func Info

func Info(ctx context.Context, format string, a ...interface{})

func InfoLevelEnabler

func InfoLevelEnabler() zap.LevelEnablerFunc

func Init

func Init(options ...Option)

Init 日志初始化

func Warn

func Warn(ctx context.Context, format string, a ...interface{})

func WarnLevelEnabler

func WarnLevelEnabler() zap.LevelEnablerFunc

Types

type Config

type Config struct {
	AppName      string
	SplitFormat  string
	Path         string
	ContextParam []string
}

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

type Option

type Option func(*Logger)

Option customer option

func AddCore

func AddCore(fileName string, levelEnable zapcore.LevelEnabler, logFileOption ...rotate.Option) Option

AddCore add core

func SetConfig

func SetConfig(c Config) Option

SetConfig option Set Config

func SetEncoder

func SetEncoder(enc zapcore.Encoder) Option

SetEncoder Set customer Encoder

func SetZapOptions

func SetZapOptions(options ...zap.Option) Option

SetZapOptions Set zap Logger

Directories

Path Synopsis
Package encoder copy from zapcore.jsonEncoder
Package encoder copy from zapcore.jsonEncoder
bufferpool
Package bufferpool houses zap's shared internal buffer pool.
Package bufferpool houses zap's shared internal buffer pool.

Jump to

Keyboard shortcuts

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