log

package
v1.24.5 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const SlowQueryThreshold = 300 * time.Millisecond
View Source
const TimeFormat = "2006-01-02 15:04:05.999"

Variables

View Source
var AtomicLevel = zap.NewAtomicLevel() // 通过更改 level 可一更改runtime logger的level
View Source
var FromContextOrDiscard = logr.FromContextOrDiscard
View Source
var GlobalLogger, LogrLogger = MustNewLogger()
View Source
var NewContext = logr.NewContext

Functions

func Debugf

func Debugf(fmt string, v ...interface{})

func DefaultGinLoggerMideare

func DefaultGinLoggerMideare() gin.HandlerFunc

func Error

func Error(err error, msg string, keysAndValues ...interface{})

func Errorf

func Errorf(fmt string, v ...interface{})

func Fatalf

func Fatalf(fmt string, v ...interface{})

func Info

func Info(msg string, keysAndValues ...interface{})

func Infof

func Infof(fmt string, v ...interface{})

func MustNewLogger

func MustNewLogger() (*zap.Logger, logr.Logger)

func NewGinLoggerMideare

func NewGinLoggerMideare(logger *zap.Logger) gin.HandlerFunc

GinLoggerMideare is the gin logger handler

func SetGinDebugPrintRouteFunc

func SetGinDebugPrintRouteFunc(logger *zap.Logger)

Gindebug

func SetLevel

func SetLevel(level string)

func Tracef

func Tracef(fmt string, v ...interface{})

func V

func V(level int) logr.Logger

func Warnf

func Warnf(fmt string, v ...interface{})

func WithField

func WithField(key string, value interface{}) *zap.SugaredLogger

use .Info("",fields), or .With(fields).Info("") instead

func WithName

func WithName(name string) logr.Logger

func WithValues

func WithValues(keysAndValues ...interface{}) logr.Logger

Types

type GormLogger

type GormLogger struct {
	SourceField           string
	SlowThreshold         time.Duration
	SkipErrRecordNotFound bool
	// contains filtered or unexported fields
}

func NewDefaultGormZapLogger

func NewDefaultGormZapLogger() *GormLogger

func NewGormZapLogger

func NewGormZapLogger(logger *zap.Logger) *GormLogger

func (*GormLogger) Error

func (l *GormLogger) Error(ctx context.Context, s string, args ...interface{})

func (*GormLogger) Info

func (l *GormLogger) Info(ctx context.Context, s string, args ...interface{})

func (*GormLogger) LogMode

func (l *GormLogger) LogMode(loglevel logger.LogLevel) logger.Interface

func (*GormLogger) Trace

func (l *GormLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)

func (*GormLogger) Warn

func (l *GormLogger) Warn(ctx context.Context, s string, args ...interface{})

type Logger

type Logger = zap.SugaredLogger

Jump to

Keyboard shortcuts

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