Documentation ¶
Index ¶
- func LogHandler(config *model.LoggerConfig) slog.Handler
- func NewQuartzLogger(ctx context.Context) logger.Logger
- func ToExitVal(err error) int
- type IPAddress
- type IPRateLimiter
- type IPWhiteList
- type QuartzLogger
- func (l *QuartzLogger) Debug(msg any)
- func (l *QuartzLogger) Debugf(format string, args ...any)
- func (l *QuartzLogger) Enabled(_ logger.Level) bool
- func (l *QuartzLogger) Error(msg any)
- func (l *QuartzLogger) Errorf(format string, args ...any)
- func (l *QuartzLogger) Info(msg any)
- func (l *QuartzLogger) Infof(format string, args ...any)
- func (l *QuartzLogger) Trace(msg any)
- func (l *QuartzLogger) Tracef(format string, args ...any)
- func (l *QuartzLogger) Warn(msg any)
- func (l *QuartzLogger) Warnf(format string, args ...any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogHandler ¶
func LogHandler(config *model.LoggerConfig) slog.Handler
LogHandler returns the application log handler with the configured level.
func NewQuartzLogger ¶
NewQuartzLogger returns a new QuartzLogger.
Types ¶
type IPRateLimiter ¶
IPRateLimiter represents a rate limiter based on an IP address.
func NewIPRateLimiter ¶
func NewIPRateLimiter(tps rate.Limit, size int) *IPRateLimiter
NewIPRateLimiter returns a new IPRateLimiter.
func (*IPRateLimiter) AddLimiter ¶
func (ipLimiter *IPRateLimiter) AddLimiter(ipAddr string) *rate.Limiter
AddLimiter creates a new rate limiter and adds it to the limiters map, using the IP address as the key.
func (*IPRateLimiter) GetLimiter ¶
func (ipLimiter *IPRateLimiter) GetLimiter(ipAddr string) *rate.Limiter
GetLimiter returns the rate limiter for the provided IP address if it exists. Otherwise calls AddLimiter to add a new limiter to the map.
type IPWhiteList ¶
type IPWhiteList struct {
// contains filtered or unexported fields
}
func NewIPWhiteList ¶
func NewIPWhiteList(ipList []string) *IPWhiteList
func (*IPWhiteList) IsAllowed ¶
func (wl *IPWhiteList) IsAllowed(ip string) bool
type QuartzLogger ¶
type QuartzLogger struct {
// contains filtered or unexported fields
}
QuartzLogger implements the quartz logger interface.
func (*QuartzLogger) Debugf ¶
func (l *QuartzLogger) Debugf(format string, args ...any)
Debugf logs at LevelDebug.
func (*QuartzLogger) Errorf ¶
func (l *QuartzLogger) Errorf(format string, args ...any)
Errorf logs at LevelError.
func (*QuartzLogger) Infof ¶
func (l *QuartzLogger) Infof(format string, args ...any)
Infof logs at LevelInfo.
func (*QuartzLogger) Tracef ¶
func (l *QuartzLogger) Tracef(format string, args ...any)
Tracef logs at LevelTrace.
func (*QuartzLogger) Warnf ¶
func (l *QuartzLogger) Warnf(format string, args ...any)
Warnf logs at LevelWarn.