logger

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrChannelFull ...
	ErrChannelFull = errors.New("日志通道缓存已满,请取出数据")
)

Functions

func NewChannelWriter

func NewChannelWriter(ChannelLen int) *logChannelWriter

NewChannelWriter ...

func StringToZapLevelHookFunc

func StringToZapLevelHookFunc() mapstructure.DecodeHookFunc

StringToZapLevelHookFunc 将字符串转换为 zapcore.Level 类型 为 viper 使用

Types

type LoggerSettingS

type LoggerSettingS struct {
	LogLevel zapcore.Level `json:"log_level"`

	OutFile    bool   `json:"out_file"`
	FilePath   string `json:"file_path"`
	MaxSize    int    `json:"max_size"`
	MaxBackups int    `json:"max_backups"`
	MaxAge     int    `json:"max_age"`

	OutConsole bool `json:"out_console"`

	OutChannel        bool   `json:"out_channel"`
	ChannelEncodeType string `json:"channel_encode_type"`
	ChannelBufferLen  int    `json:"channel_buffer_len"`
}

LoggerSettingS ...

func (*LoggerSettingS) String

func (s *LoggerSettingS) String() string

String ...

type ZapPool

type ZapPool struct {
	L  *zap.Logger
	SL *zap.SugaredLogger
	// contains filtered or unexported fields
}

ZapPool ...

func NewZapPool

func NewZapPool(s *LoggerSettingS) *ZapPool

NewLogger 获取日志不包括

func NewZapPoolC

func NewZapPoolC(s *LoggerSettingS) *ZapPool

NewZapPoolC ...

func (ZapPool) GetLogChannel

func (p ZapPool) GetLogChannel() <-chan []byte

GetLogChannel 获取日志的通道

func (ZapPool) GetLogSettings

func (p ZapPool) GetLogSettings() *LoggerSettingS

PrintLogSettings 输出日志系统的配置信息

func (ZapPool) WithCaller

func (p ZapPool) WithCaller() *ZapPool

GetLogChannel 获取日志的通道

Jump to

Keyboard shortcuts

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