}
}
-void LogConfigParser::applyConfiguration() {
-
- static const std::string STDOUT = "stdout";
- static const std::string STDERR = "stderr";
- static const std::string SYSLOG = "syslog";
- static const std::string SYSLOG_COLON = "syslog:";
-
- std::vector<LoggerSpecification> specs;
-
- // Now iterate through all specified loggers
- const LoggingInfoStorage& logging_info = config_->getLoggingInfo();
- for (LoggingInfoStorage::const_iterator it = logging_info.begin();
- it != logging_info.end(); ++it) {
-
- // Prepare the objects to define the logging specification
- LoggerSpecification spec(it->name_,
- it->severity_,
- it->debuglevel_);
- OutputOption option;
-
- for (std::vector<LoggingDestination>::const_iterator dest = it->destinations_.begin();
- dest != it->destinations_.end(); ++dest) {
-
- // Set up output option according to destination specification
- if (dest->output_ == STDOUT) {
- option.destination = OutputOption::DEST_CONSOLE;
- option.stream = OutputOption::STR_STDOUT;
-
- } else if (dest->output_ == STDERR) {
- option.destination = OutputOption::DEST_CONSOLE;
- option.stream = OutputOption::STR_STDERR;
-
- } else if (dest->output_ == SYSLOG) {
- option.destination = OutputOption::DEST_SYSLOG;
- // Use default specified in OutputOption constructor for the
- // syslog destination
-
- } else if (dest->output_.find(SYSLOG_COLON) == 0) {
- option.destination = OutputOption::DEST_SYSLOG;
- // Must take account of the string actually being "syslog:"
- if (dest->output_ == SYSLOG_COLON) {
- // The expected syntax is syslog:facility. User skipped
- // the logging name, so we'll just use the default ("kea")
- option.facility = isc::log::getDefaultRootLoggerName();
-
- } else {
- // Everything else in the string is the facility name
- option.facility = dest->output_.substr(SYSLOG_COLON.size());
- }
-
- } else {
- // Not a recognised destination, assume a file.
- option.destination = OutputOption::DEST_FILE;
- option.filename = dest->output_;
- }
-
- // ... and set the destination
- spec.addOutputOption(option);
- }
-
- specs.push_back(spec);
- }
-
- LoggerManager manager;
- manager.process(specs.begin(), specs.end());
-}
-
} // namespace isc::dhcp
} // namespace isc