]> git.ipfire.org Git - people/stevee/guardian.git/blobdiff - modules/Config.pm
Validate configured LogLevel when reading-in the config file.
[people/stevee/guardian.git] / modules / Config.pm
index 569b2ceb99da109242265b772d13e66eff9f6795..038ba35b6f625d414743cacbba2c1f8398bad291 100644 (file)
@@ -153,7 +153,13 @@ sub CheckConfig (\%) {
                }
        }
 
-       # XXX - add check for validating the configured loglevel.
+       # Gather details about supported log levels.
+       my %supported_loglevels = &Guardian::Logger::GetLogLevels();
+
+       # Check if the configured log level is valid.
+       unless (exists ($supported_loglevels{$config{LogLevel}})) {
+               return "Invalid LogLevel: $config{LogLevel}";
+       }
 
        # The config looks good, so return nothing (no error message).
        return undef