logtool

package
v0.0.0-...-31e44ea Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 //日志等级
	MaxSize       int           //日志文件小大(M)
	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