10#include <boost/lexical_cast.hpp>
23 :config_(storage), verbose_(false) {
26 "configuration, so parsed data can be stored there");
35 for (
auto const& logger : loggers->listValue()) {
36 parseConfigEntry(logger);
52 info.clearDestinations();
57 info.setContext(user_context);
64 "element (" << entry->getPosition() <<
")");
66 info.name_ = name_ptr->stringValue();
85 info.debuglevel_ = boost::lexical_cast<int>(debuglevel_ptr->str());
86 if ( (
info.debuglevel_ < 0) || (
info.debuglevel_ > 99) ) {
92 << debuglevel_ptr->stringValue()
93 <<
"', expected 0-99 ("
94 << debuglevel_ptr->getPosition() <<
")");
103 info.debuglevel_ = 99;
108 if (output_options) {
109 parseOutputOptions(
info.destinations_, output_options);
112 config_->addLoggingInfo(info);
115void LogConfigParser::parseOutputOptions(std::vector<LoggingDestination>& destination,
117 if (!output_options) {
121 for (
auto const& output_option : output_options->listValue()) {
123 LoggingDestination dest;
128 "element (" << output_option->getPosition() <<
")");
130 dest.output_ = output->stringValue();
134 dest.maxver_ = boost::lexical_cast<int>(maxver_ptr->str());
139 dest.maxsize_ = boost::lexical_cast<uint64_t>(maxsize_ptr->str());
144 dest.flush_ = flush_ptr->boolValue();
149 dest.pattern_ = pattern->stringValue();
152 destination.push_back(dest);
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
LogConfigParser(const ConfigPtr &storage)
Constructor.
void parseConfiguration(const isc::data::ConstElementPtr &log_config, bool verbose=false)
Parses specified configuration.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
Logging initialization functions.
boost::shared_ptr< const Element > ConstElementPtr
isc::log::Severity getSeverity(const std::string &sev_str)
Returns the isc::log::Severity value represented by the given string.
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.
Defines the logger used by the top-level component of kea-lfc.