Documentation
¶
Index ¶
- func EntLogFuncFrom(logger kratoslog.Logger, module string) func(...any)
- func GormLoggerFrom(logger kratoslog.Logger, module string) gormlogger.Interface
- type GormLogger
- func (l GormLogger) Error(ctx context.Context, str string, args ...any)
- func (l GormLogger) Info(ctx context.Context, str string, args ...any)
- func (l GormLogger) LogMode(level gormlogger.LogLevel) gormlogger.Interface
- func (l GormLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (l GormLogger) Warn(ctx context.Context, str string, args ...any)
- type Helper
- type Logger
- type Option
- type ZapLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GormLoggerFrom ¶
func GormLoggerFrom(logger kratoslog.Logger, module string) gormlogger.Interface
Types ¶
type GormLogger ¶
GormLogger 操作对象,实现 gormlogger.Interface
func (GormLogger) Error ¶
func (l GormLogger) Error(ctx context.Context, str string, args ...any)
Error 实现 gormlogger.Interface 的 Error 方法
func (GormLogger) Info ¶
func (l GormLogger) Info(ctx context.Context, str string, args ...any)
Info 实现 gormlogger.Interface 的 Info 方法
func (GormLogger) LogMode ¶
func (l GormLogger) LogMode(level gormlogger.LogLevel) gormlogger.Interface
LogMode 实现 gormlogger.Interface 的 LogMode 方法
type Helper ¶
type Option ¶
type Option func(keyvals *[]any)
Option is a function that appends key-value pairs to a logger's fields.
func WithModule ¶
WithModule returns an Option that adds a "module" field. Naming convention: "component/layer/service" (e.g. "user/biz/iam").
type ZapLogger ¶
type ZapLogger struct {
// contains filtered or unexported fields
}
ZapLogger wraps *zap.Logger and satisfies kratos log.Logger.
func New ¶
New creates a ZapLogger from a proto App config. nil-safe: returns a dev console logger when app is nil or app.Log is nil.
func (*ZapLogger) GetGormLogger ¶
func (l *ZapLogger) GetGormLogger(module string) GormLogger
GetGormLogger returns a GORM-compatible logger scoped to the given module.
Click to show internal directories.
Click to hide internal directories.