Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
Get extracts a logger from the context. If no logger is found in the context, it returns the default logger. This function is safe to call with a nil context.
func NewZapLoggingModule ¶
NewZapLoggingModule creates a new fx module for zap logger initialization. It provides a configured *zap.Logger instance and integrates with fx lifecycle.
Types ¶
type Config ¶
type Config struct {
// Level specifies the minimum logging level.
// Use zapcore constants: DebugLevel, InfoLevel, WarnLevel, ErrorLevel, DPanicLevel, PanicLevel, FatalLevel
Level zapcore.Level
// Development enables development mode with console encoding and human-readable timestamps.
// In production mode (false), JSON encoding is used.
Development bool
// StacktraceLevel sets the minimum level at which stacktraces are captured.
// Use zapcore constants: DebugLevel, InfoLevel, WarnLevel, ErrorLevel, DPanicLevel, PanicLevel, FatalLevel
// Defaults to ErrorLevel.
StacktraceLevel zapcore.Level
}
type LogThrottler ¶
type LogThrottler struct {
// contains filtered or unexported fields
}
LogThrottler provides rate-limited logging functionality. Each instance maintains its own isolated map of rate limiters, allowing different components to have independent throttling.
func NewLogThrottler ¶
func NewLogThrottler(log *zap.Logger, interval time.Duration) *LogThrottler
NewLogThrottler creates a new LogThrottler with the given logger. The interval parameter specifies how often a WARN log is allowed per key. If interval is 0, it defaults to 5 minutes.