package config import ( "fmt" "os" ) // Logger configures the minimum severity written as structured JSON to stderr. type Logger struct { // Level is one of debug, info, warn or error; the default is info. Level string } // loadEnvironment applies environment overrides to this configuration section. func (cfg *Logger) loadEnvironment() { if level, exists := os.LookupEnv("LOG_LEVEL"); exists { cfg.Level = level } } // Validate rejects unsupported levels rather than silently changing verbosity. func (cfg *Logger) Validate() error { if cfg == nil { return fmt.Errorf("Logger configuration is required") } switch cfg.Level { case "debug", "info", "warn", "error": return nil default: return fmt.Errorf("LOG_LEVEL must be debug, info, warn or error") } }