logger

package
v0.0.0-...-cf52b1d Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const GormLoggerCallerSkip = 2

Variables

This section is empty.

Functions

func Debug

func Debug(c context.Context, msg string, fields ...zap.Field)

func Debugf

func Debugf(c context.Context, format string, args ...interface{})

func Error

func Error(c context.Context, msg string, fields ...zap.Field)

func Errorf

func Errorf(c context.Context, format string, args ...interface{})

func Fatal

func Fatal(c context.Context, msg string, fields ...zap.Field)

func Fatalf

func Fatalf(c context.Context, format string, args ...interface{})

func Info

func Info(c context.Context, msg string, fields ...zap.Field)

func Infof

func Infof(c context.Context, format string, args ...interface{})

func Init

func Init(profile string, config *Config)

func NewZapLogger

func NewZapLogger(profile string, config *Config) *zap.Logger

func Panic

func Panic(c context.Context, msg string, fields ...zap.Field)

func Panicf

func Panicf(c context.Context, format string, args ...interface{})

func Sync

func Sync()

func Warn

func Warn(c context.Context, msg string, fields ...zap.Field)

func Warnf

func Warnf(c context.Context, format string, args ...interface{})

func WithTrace

func WithTrace(c context.Context, traceID string) context.Context

Types

type Config

type Config struct {
	Level      string `mapstructure:"level"`
	Dir        string `mapstructure:"dir"`
	MaxSize    int    `mapstructure:"maxSize"`
	MaxBackups int    `mapstructure:"maxBackups"`
	MaxAge     int    `mapstructure:"maxAge"`

	SkipPaths   []string `mapstructure:"skipPaths"`
	Desensitize bool     `mapstructure:"desensitize"`
	SkipFields  []string `mapstructure:"skipFields"`
}

type GormLogger

type GormLogger struct {
	ZapLogger *zap.Logger
	// contains filtered or unexported fields
}

func NewGormLogger

func NewGormLogger() GormLogger

func (GormLogger) Error

func (g GormLogger) Error(ctx context.Context, msg string, data ...interface{})

Error 实现 gorm logger 接口方法

func (GormLogger) Info

func (g GormLogger) Info(ctx context.Context, msg string, data ...interface{})

Info 实现 gorm logger 接口方法

func (GormLogger) LogMode

func (g GormLogger) LogMode(gormLogLevel gormlogger.LogLevel) gormlogger.Interface

LogMode 实现 gorm logger 接口方法

func (GormLogger) Trace

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

Trace 实现 gorm logger 接口方法

func (GormLogger) Warn

func (g GormLogger) Warn(ctx context.Context, msg string, data ...interface{})

Warn 实现 gorm logger 接口方法

Jump to

Keyboard shortcuts

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