Add structured logging with zerolog
- Implement zerolog logger package with configurable levels - Add contextual logging middleware (request_id, user_id, method, path, status, duration) - Support both JSON (production) and human-readable (development) formats - Add LOG_LEVEL and ENVIRONMENT configuration variables - Replace standard log calls with structured logger throughout application - Integrate logger in HTTP router and auth middleware
This commit is contained in:
@@ -23,6 +23,8 @@ type Config struct {
|
||||
SupportEmail string
|
||||
SendWelcomeEmail string
|
||||
RegistrationMode string
|
||||
LogLevel string
|
||||
Environment string
|
||||
}
|
||||
|
||||
func Load() (*Config, error) {
|
||||
@@ -44,6 +46,8 @@ func Load() (*Config, error) {
|
||||
SupportEmail: getEnvOrDefault("SUPPORT_EMAIL", "contact@apocapoc.app"),
|
||||
SendWelcomeEmail: getEnvOrDefault("SEND_WELCOME_EMAIL", "false"),
|
||||
RegistrationMode: getEnvOrDefault("REGISTRATION_MODE", "open"),
|
||||
LogLevel: getEnvOrDefault("LOG_LEVEL", "info"),
|
||||
Environment: getEnvOrDefault("ENVIRONMENT", "production"),
|
||||
}
|
||||
|
||||
if cfg.DBPath == "" {
|
||||
|
||||
Reference in New Issue
Block a user