Documentation ¶
Index ¶
- func Any(key string, value any) func(ctx context.Context) zap.Field
- func Float64(key string, value float64) func(ctx context.Context) zap.Field
- func Immutable(key string, value any) func(ctx context.Context) zap.Field
- func Int64(key string, value int64) func(ctx context.Context) zap.Field
- func New(zapLogger *zap.Logger, opts ...Option) logger.Interface
- func SetGormDBLogger(db *gorm.DB, l logger.Interface)
- func String(key string, value string) func(ctx context.Context) zap.Field
- func Uint64(key string, value uint64) func(ctx context.Context) zap.Field
- type CallerCore
- func (c *CallerCore) AddSkip(callerSkip int) *CallerCore
- func (c *CallerCore) AddSkipPackage(vs ...string) *CallerCore
- func (c *CallerCore) Enabled(lvl zapcore.Level) bool
- func (c *CallerCore) Level() zapcore.Level
- func (c *CallerCore) SetLevel(lv zapcore.Level) *CallerCore
- func (c *CallerCore) UseExternalLevel(l zap.AtomicLevel) *CallerCore
- type Logger
- func (l *Logger) Error(ctx context.Context, msg string, args ...any)
- func (l *Logger) Info(ctx context.Context, msg string, args ...any)
- func (l *Logger) LogMode(level logger.LogLevel) logger.Interface
- func (l *Logger) Trace(ctx context.Context, begin time.Time, f func() (string, int64), err error)
- func (l *Logger) Warn(ctx context.Context, msg string, args ...any)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetGormDBLogger ¶
SetGormDBLogger set db logger
Types ¶
type CallerCore ¶ added in v0.3.2
type CallerCore struct {
// contains filtered or unexported fields
}
func NewCallerCore ¶ added in v0.3.2
func NewCallerCore() *CallerCore
func (*CallerCore) AddSkip ¶ added in v0.3.2
func (c *CallerCore) AddSkip(callerSkip int) *CallerCore
AddSkip add the number of callers skipped by caller annotation.
func (*CallerCore) AddSkipPackage ¶ added in v0.3.2
func (c *CallerCore) AddSkipPackage(vs ...string) *CallerCore
AddSkipPackage add the caller skip package.
func (*CallerCore) Enabled ¶ added in v0.3.2
func (c *CallerCore) Enabled(lvl zapcore.Level) bool
Enabled returns true if the given level is at or above this level.
func (*CallerCore) Level ¶ added in v0.3.2
func (c *CallerCore) Level() zapcore.Level
Level returns the minimum enabled log level.
func (*CallerCore) SetLevel ¶ added in v0.3.2
func (c *CallerCore) SetLevel(lv zapcore.Level) *CallerCore
SetLevel set the caller level.
func (*CallerCore) UseExternalLevel ¶ added in v0.3.2
func (c *CallerCore) UseExternalLevel(l zap.AtomicLevel) *CallerCore
UseExternalLevel use external level, which controller by user.
type Logger ¶
Logger logger for gorm2
type Option ¶
type Option func(l *Logger)
Option logger/recover option
func WithCallerCore ¶ added in v0.3.2
func WithCallerCore(c *CallerCore) Option
WithConfig optional custom logger.Config
func WithConfig ¶
WithConfig optional custom logger.Config
func WithCustomFields ¶
WithCustomFields optional custom field
func WithSkipPackages ¶ added in v0.0.4
WithSkipPackages optional custom logger.Config
Click to show internal directories.
Click to hide internal directories.