zap_log

package
v0.1.25 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: LGPL-2.1 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Install   = plugin.Install
	Uninstall = plugin.Uninstall
)

Functions

func NewConsoleZapLogger

func NewConsoleZapLogger(level zapcore.Level, separator, fileName string, maxSize int, stdout, development bool) (*zap.Logger, zap.AtomicLevel)

NewConsoleZapLogger 创建控制台样式zap logger(支持文件分割)

func NewJsonZapLogger

func NewJsonZapLogger(level zapcore.Level, fileName string, maxSize int, stdout, development bool) (*zap.Logger, zap.AtomicLevel)

NewJsonZapLogger 创建Json样式zap logger(支持文件分割)

Types

type LoggerOptions

type LoggerOptions struct {
	ZapLogger   *zap.Logger
	ServiceInfo bool
	RuntimeInfo bool
	CallerSkip  int
}

LoggerOptions 所有选项

type Option

type Option struct{}

Option 所有选项设置器

func (Option) CallerSkip

func (Option) CallerSkip(skip int) option.Setting[LoggerOptions]

CallerSkip 调用堆栈skip值,用于打印调用堆栈信息

func (Option) Default

func (Option) Default() option.Setting[LoggerOptions]

Default 默认值

func (Option) RuntimeInfo

func (Option) RuntimeInfo(b bool) option.Setting[LoggerOptions]

RuntimeInfo 添加runtime信息

func (Option) ServiceInfo

func (Option) ServiceInfo(b bool) option.Setting[LoggerOptions]

ServiceInfo 添加service信息

func (Option) ZapLogger

func (Option) ZapLogger(logger *zap.Logger) option.Setting[LoggerOptions]

ZapLogger zap logger

Jump to

Keyboard shortcuts

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