Documentation ¶
Index ¶
- Constants
- Variables
- func Debugf(fmt string, v ...interface{})
- func DefaultGinLoggerMideare() gin.HandlerFunc
- func Error(err error, msg string, keysAndValues ...interface{})
- func Errorf(fmt string, v ...interface{})
- func Fatalf(fmt string, v ...interface{})
- func Info(msg string, keysAndValues ...interface{})
- func Infof(fmt string, v ...interface{})
- func MustNewLogger() (*zap.Logger, logr.Logger)
- func NewGinLoggerMideare(logger *zap.Logger) gin.HandlerFunc
- func SetGinDebugPrintRouteFunc(logger *zap.Logger)
- func SetLevel(level string)
- func Tracef(fmt string, v ...interface{})
- func V(level int) logr.Logger
- func Warnf(fmt string, v ...interface{})
- func WithField(key string, value interface{}) *zap.SugaredLogger
- func WithName(name string) logr.Logger
- func WithValues(keysAndValues ...interface{}) logr.Logger
- type GormLogger
- func (l *GormLogger) Error(ctx context.Context, s string, args ...interface{})
- func (l *GormLogger) Info(ctx context.Context, s string, args ...interface{})
- func (l *GormLogger) LogMode(loglevel logger.LogLevel) logger.Interface
- func (l *GormLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (l *GormLogger) Warn(ctx context.Context, s string, args ...interface{})
- type Logger
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 DefaultGinLoggerMideare ¶
func DefaultGinLoggerMideare() gin.HandlerFunc
func NewGinLoggerMideare ¶
func NewGinLoggerMideare(logger *zap.Logger) gin.HandlerFunc
GinLoggerMideare is the gin logger handler
func WithField ¶
func WithField(key string, value interface{}) *zap.SugaredLogger
use .Info("",fields), or .With(fields).Info("") instead
func WithValues ¶
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
type Logger ¶
type Logger = zap.SugaredLogger
Click to show internal directories.
Click to hide internal directories.