log

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get() *zap.Logger

Get 获取初始化后Logger实例

func Init

func Init(opts ...ModOptions) *zap.Logger

Init 初始化日志

func NewLogger

func NewLogger(mod ...ModOptions) *zap.Logger

Types

type Logger

type Logger struct {
	*zap.Logger
	sync.RWMutex
	Opts *Options `json:"opts"`
	// contains filtered or unexported fields
}

type ModOptions

type ModOptions func(options *Options)

func SetAppName

func SetAppName(AppName string) ModOptions

func SetDebugFileName

func SetDebugFileName(DebugFileName string) ModOptions

func SetDevelopment

func SetDevelopment(Development bool) ModOptions

func SetErrorFileName

func SetErrorFileName(ErrorFileName string) ModOptions

func SetInfoFileName

func SetInfoFileName(InfoFileName string) ModOptions

func SetLevel

func SetLevel(Level zapcore.Level) ModOptions

func SetLogFileDir

func SetLogFileDir(LogFileDir string) ModOptions

func SetMaxAge

func SetMaxAge(MaxAge int) ModOptions

func SetMaxBackups

func SetMaxBackups(MaxBackups int) ModOptions

func SetMaxSize

func SetMaxSize(MaxSize int) ModOptions

func SetWarnFileName

func SetWarnFileName(WarnFileName string) ModOptions

type Options

type Options struct {
	// 日志文件保存位置
	LogFileDir    string
	AppName       string
	ErrorFileName string
	WarnFileName  string
	InfoFileName  string
	DebugFileName string
	Level         zapcore.Level
	// 日志文件大小(MB)
	MaxSize int
	// 最多存在多少切片文件
	MaxBackups int
	// 保存的最大天数
	MaxAge int
	// 是否开启开发模式
	Development bool
	zap.Config
}

Jump to

Keyboard shortcuts

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