logutil

package
v0.0.0-...-a6492d2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DPanic

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

func Debug

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

func Error

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

func Fatal

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

func Info

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

func NewLogger

func NewLogger(opt ...logOptionsFunc) (*zap.Logger, error)

func Panic

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

func SDPanic

func SDPanic(tpl string, args ...interface{})

func SDebug

func SDebug(tpl string, args ...interface{})

func SError

func SError(tpl string, args ...interface{})

func SFatal

func SFatal(tpl string, args ...interface{})

func SInfo

func SInfo(tpl string, args ...interface{})

func SPanic

func SPanic(tpl string, args ...interface{})

func SWarn

func SWarn(tpl string, args ...interface{})

func Sync

func Sync()

func Warn

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

func WithEncodingConsole

func WithEncodingConsole(v bool) logOptionsFunc

func WithMaxAge

func WithMaxAge(v int) logOptionsFunc

func WithMaxBackups

func WithMaxBackups(v int) logOptionsFunc

func WithMaxSize

func WithMaxSize(v int) logOptionsFunc

func WithPath

func WithPath(v string) logOptionsFunc

func WithStdout

func WithStdout(v bool) logOptionsFunc

Types

type LogOptions

type LogOptions struct {
	// 日志存储路径
	Path string
	// 单个文件大小,单位M
	MaxSize int
	// 最多保存文件个数
	MaxBackups int
	// 最多保留天数
	MaxAge int
	// 是否标准输出
	Stdout bool
	// 输出console格式
	EncodingConsole bool
}

type Logger

type Logger interface {
	Debug(v ...interface{})
	Debugf(format string, v ...interface{})
	Info(v ...interface{})
	Infof(format string, v ...interface{})
	Warn(v ...interface{})
	Warnf(format string, v ...interface{})
	Error(v ...interface{})
	Errorf(format string, v ...interface{})
}

func NewZapLogger

func NewZapLogger(l *zap.Logger) Logger

Jump to

Keyboard shortcuts

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