mg-transport-core/core/logger/nil.go

63 lines
1.2 KiB
Go
Raw Normal View History

2023-11-24 15:23:07 +03:00
package logger
import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
2024-06-07 17:55:45 +03:00
// Nil logger doesn't do anything.
2023-11-24 15:23:07 +03:00
type Nil struct{}
2024-06-07 17:55:45 +03:00
// NewNil constructs new *Nil.
2023-11-24 15:23:07 +03:00
func NewNil() Logger {
return &Nil{}
}
func (l *Nil) With(fields ...zap.Field) Logger {
return l
}
func (l *Nil) WithLazy(fields ...zap.Field) Logger {
return l
}
func (l *Nil) Level() zapcore.Level {
return zapcore.DebugLevel
}
func (l *Nil) Check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry {
return &zapcore.CheckedEntry{}
}
func (l *Nil) Log(lvl zapcore.Level, msg string, fields ...zap.Field) {}
func (l *Nil) Debug(msg string, fields ...zap.Field) {}
func (l *Nil) Info(msg string, fields ...zap.Field) {}
func (l *Nil) Warn(msg string, fields ...zap.Field) {}
func (l *Nil) Error(msg string, fields ...zap.Field) {}
func (l *Nil) DPanic(msg string, fields ...zap.Field) {}
func (l *Nil) Panic(msg string, fields ...zap.Field) {}
func (l *Nil) Fatal(msg string, fields ...zap.Field) {}
2024-01-19 13:17:04 +03:00
func (l *Nil) ForHandler(handler any) Logger {
return l
}
func (l *Nil) ForConnection(conn any) Logger {
return l
}
func (l *Nil) ForAccount(acc any) Logger {
2023-11-24 15:23:07 +03:00
return l
}
func (l *Nil) Sync() error {
return nil
}