logger

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 14 Imported by: 0

README

logger

日志工具

如何使用?

通过go get获取:

go get github.com/ZYallers/golib/logger

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DPanic

func DPanic(msg string, fields ...zap.Field)

func Debug

func Debug(msg string, fields ...zap.Field)

func Default

func Default() *zap.Logger

func Error

func Error(msg string, fields ...zap.Field)

func Fatal

func Fatal(msg string, fields ...zap.Field)

func GetLoggerDir

func GetLoggerDir() string

func Info

func Info(msg string, fields ...zap.Field)

func NewGormLogger

func NewGormLogger(name string, slowThreshold time.Duration, level gormless.LogLevel, sender GormLogSender) gormless.Interface

func NewLogger

func NewLogger(file string, opts ...Option) *zap.Logger

func Panic

func Panic(msg string, fields ...zap.Field)

func RedirectStdLog

func RedirectStdLog(log *zap.Logger)

func SetDefault

func SetDefault(log *zap.Logger)

func SetLoggerDir

func SetLoggerDir(dir string)

func Use

func Use(filename string, opts ...Option) *zap.Logger

func Warn

func Warn(msg string, fields ...zap.Field)

func With

func With(fields ...zap.Field) *zap.Logger

func WithOptions

func WithOptions(opts ...zap.Option) *zap.Logger

Types

type GormLogSender

type GormLogSender interface {
	Push(string)
	Open() bool
	Always() bool
}

type Option

type Option func(c *config)

func WithCompress

func WithCompress(b bool) Option

func WithLocalTime

func WithLocalTime(b bool) Option

func WithMaxAge

func WithMaxAge(s int) Option

func WithMaxBackups

func WithMaxBackups(b int) Option

func WithMaxSize

func WithMaxSize(s int) Option

Jump to

Keyboard shortcuts

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