logger

package
v0.0.0-...-3716ba0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GVA_LOG *zap.Logger
)

Functions

func Debug

func Debug(ctx context.Context, msg string, attributes ...zap.Field)

func Error

func Error(ctx context.Context, msg string, attributes ...zap.Field)

Error record error

func GetFileWithLineNum

func GetFileWithLineNum() string

func Info

func Info(ctx context.Context, msg string, attributes ...zap.Field)

Info record info

func InitLog

func InitLog(l *zap.Logger)

func LoggerClose

func LoggerClose(ctx context.Context)

func SetContext

func SetContext(ctx context.Context, traceArgs ...string) context.Context

func SetContextLogger

func SetContextLogger(ctx context.Context, logger *Logger) context.Context

func Warn

func Warn(ctx context.Context, msg string, attributes ...zap.Field)

Warn record warn

Types

type Logger

type Logger struct {
	*zap.Logger
	sync.RWMutex
	Opts *Options `json:"opts"`

	TaskId string
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(flag string, mod ...ModOptions) *Logger

type ModOptions

type ModOptions func(options *Options)

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