log

package
v0.0.0-...-b3f7bda Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultEncoder

func DefaultEncoder() zapcore.Encoder

统一用json

func DefaultEncoderConfig

func DefaultEncoderConfig() zapcore.EncoderConfig

func DefaultLumberjackLogger

func DefaultLumberjackLogger() *lumberjack.Logger

1.不会自动清理backup 2.每200mb压缩一次,不按时间rotate

func DefaultOption

func DefaultOption() []zap.Option

func NewLogger

func NewLogger(plugin zapcore.Core, options ...zap.Option) *zap.Logger

NOTE: 一些option选项是无法覆盖的

Types

type Plugin

type Plugin = zapcore.Core

func NewFilePlugin

func NewFilePlugin(
	filePath string, enabler zapcore.LevelEnabler) (Plugin, io.Closer)

Lumberjack logger虽然持有File但没有暴露sync方法,所以没办法利用zap的sync特性 所以额外返回一个closer,需要保证在进程退出前close以保证写入的内容可以全部刷到到磁盘

func NewPlugin

func NewPlugin(writer zapcore.WriteSyncer, enabler zapcore.LevelEnabler) Plugin

func NewStderrPlugin

func NewStderrPlugin(enabler zapcore.LevelEnabler) Plugin

func NewStdoutPlugin

func NewStdoutPlugin(enabler zapcore.LevelEnabler) Plugin

Jump to

Keyboard shortcuts

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