Documentation
¶
Overview ¶
Package log provides structured logging based on Zap.
It supports console and file output with log rotation, multiple log levels, trace context propagation, and adapters for GORM and Gin. Use Info/Error/Debug etc. as top-level functions for quick logging.
Index ¶
- func Close()
- func Debug(msg string, keysAndValues ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(msg string, keysAndValues ...interface{})
- func Errorf(format string, args ...interface{})
- func Info(msg string, keysAndValues ...interface{})
- func Infof(format string, args ...interface{})
- func Json(data any)
- func Panic(msg string, keysAndValues ...interface{})
- func Panicf(format string, args ...interface{})
- func Print(args ...interface{})
- func Sync()
- func Warn(msg string, keysAndValues ...interface{})
- func Warnf(format string, args ...interface{})
- func Zaplog() *zap.Logger
- type GinLogger
- type GormLogger
- type LogInstance
- func (l *LogInstance) Debug(msg string, keysAndValues ...interface{})
- func (l *LogInstance) Debugf(format string, args ...interface{})
- func (l *LogInstance) Error(err error, msg string, keysAndValues ...interface{})
- func (l *LogInstance) Errorf(format string, args ...interface{})
- func (l *LogInstance) Info(msg string, keysAndValues ...interface{})
- func (l *LogInstance) Infof(format string, args ...interface{})
- func (l *LogInstance) Panic(msg string, keysAndValues ...interface{})
- func (l *LogInstance) Panicf(format string, args ...interface{})
- func (l *LogInstance) Sync()
- func (l *LogInstance) Warn(msg string, keysAndValues ...interface{})
- func (l *LogInstance) Warnf(format string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GinLogger ¶
type GinLogger struct {
// contains filtered or unexported fields
}
GinLogger
func GinAdapter ¶
func GinAdapter() *GinLogger
type GormLogger ¶
type GormLogger struct {
// contains filtered or unexported fields
}
GormLogger
func GormAdapter ¶
func GormAdapter() *GormLogger
func (*GormLogger) Printf ¶
func (g *GormLogger) Printf(format string, args ...interface{})
type LogInstance ¶
type LogInstance struct {
// contains filtered or unexported fields
}
LogInstance
func Trace ¶
func Trace(traceKey ...string) *LogInstance
func (*LogInstance) Debug ¶
func (l *LogInstance) Debug(msg string, keysAndValues ...interface{})
func (*LogInstance) Debugf ¶
func (l *LogInstance) Debugf(format string, args ...interface{})
func (*LogInstance) Error ¶
func (l *LogInstance) Error(err error, msg string, keysAndValues ...interface{})
func (*LogInstance) Errorf ¶
func (l *LogInstance) Errorf(format string, args ...interface{})
func (*LogInstance) Info ¶
func (l *LogInstance) Info(msg string, keysAndValues ...interface{})
func (*LogInstance) Infof ¶
func (l *LogInstance) Infof(format string, args ...interface{})
func (*LogInstance) Panic ¶
func (l *LogInstance) Panic(msg string, keysAndValues ...interface{})
func (*LogInstance) Panicf ¶
func (l *LogInstance) Panicf(format string, args ...interface{})
func (*LogInstance) Sync ¶
func (l *LogInstance) Sync()
func (*LogInstance) Warn ¶
func (l *LogInstance) Warn(msg string, keysAndValues ...interface{})
func (*LogInstance) Warnf ¶
func (l *LogInstance) Warnf(format string, args ...interface{})