Documentation
¶
Index ¶
- func FiberMiddleware(logger *zap.Logger) fiber.Handler
- func NewDevelopmentLogger() (*zap.Logger, error)
- func NewLogger(config *Config) (*zap.Logger, error)
- func NewProductionLogger(filePath string, maxSizeMB, maxBackups, maxAge int) (*zap.Logger, error)
- func SetupFiberLogger(app *fiber.App, config *Config) (*zap.Logger, error)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FiberMiddleware ¶
FiberMiddleware creates a Fiber middleware using the provided logger Stack traces are only included for 500-level (server) errors, not for client errors (4xx)
func NewDevelopmentLogger ¶
NewDevelopmentLogger creates a development logger (console output, colored)
func NewProductionLogger ¶
NewProductionLogger creates a production logger (JSON output, file rotation)
Types ¶
type Config ¶
type Config struct {
Enabled *bool `yaml:"enabled"`
FilePath string `yaml:"file_path"` // Path to log file (empty for stdout only)
MaxSize int64 `yaml:"max_size"` // Max size in bytes before rotation
MaxBackups int `yaml:"max_backups"` // Max number of backup files to retain
MaxAge int `yaml:"max_age"` // Max age of backup files in days
Level string `yaml:"level"` // Log level: debug, info, warn, error (default: info)
}
Config holds logging configuration
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a default logging configuration
Click to show internal directories.
Click to hide internal directories.