private function validateConfig(array $config)
{
if (!in_array($config["backend"], ["fluentd", "logstash"])) {
throw new LoggerException(sprintf("Unknown Audit Logger backend %s", $config["backend"]));
}
if (!in_array($config["proto"], ["file", "php", "http", "tcp", "udp", "udg", "unix"])) {
throw new LoggerException(sprintf("Audit Logger doesn't support %s protocol", $config["proto"]));
}
if (in_array($config["proto"], ["file", "unix", "udg"])) {
if (strpos($config["path"], "/") !== 0 || strlen($config["path"]) < 5) {
throw new LoggerException(sprintf("Invalid path specified (%s)", $config["path"]));
}
} elseif ($config["proto"] === "php") {
if ($config["path"] != "output") {
throw new LoggerException(sprintf("Invalid path specified (%s)", $config["path"]));
}
} else {
if (strpos($config["path"], "/") === 0) {
throw new LoggerException(sprintf("Invalid hostname specified (%s)", $config["path"]));
}
if ($config["port"] < 1 || $config["port"] > 65535) {
throw new LoggerException(sprintf("Invalid port specified (%s)", $config["port"]));
}
}
}