+bool parse_error_log(const ConfigLine &line, Config *config)
+{
+ if (line.arguments.size() != 0) {
+ log(ERROR, "'error_log' takes no arguments (only parameters type= and filename=)");
+ return false;
+ }
+
+ LogConfig log_config;
+ map<string, string>::const_iterator type_it = line.parameters.find("type");
+ if (type_it == line.parameters.end()) {
+ log(ERROR, "'error_log' has no type= parameter");
+ return false;
+ }
+
+ string type = type_it->second;
+ if (type == "file") {
+ log_config.type = LogConfig::LOG_TYPE_FILE;
+ } else if (type == "syslog") {
+ log_config.type = LogConfig::LOG_TYPE_SYSLOG;
+ } else if (type == "console") {
+ log_config.type = LogConfig::LOG_TYPE_CONSOLE;
+ } else {
+ log(ERROR, "Unknown log type '%s'", type.c_str());
+ return false;
+ }
+
+ if (log_config.type == LogConfig::LOG_TYPE_FILE) {
+ map<string, string>::const_iterator filename_it = line.parameters.find("filename");
+ if (filename_it == line.parameters.end()) {
+ log(ERROR, "error_log type 'file' with no filename= parameter");
+ return false;
+ }
+ log_config.filename = filename_it->second;
+ }
+
+ config->log_destinations.push_back(log_config);
+ return true;
+}
+