11#include <boost/lexical_cast.hpp>
24 :config_(storage), verbose_(false) {
27 "configuration, so parsed data can be stored there");
36 for (
auto const& logger : loggers->listValue()) {
37 parseConfigEntry(logger);
53 info.clearDestinations();
58 info.setContext(user_context);
65 "element (" << entry->getPosition() <<
")");
67 info.name_ = name_ptr->stringValue();
86 info.debuglevel_ = boost::lexical_cast<int>(debuglevel_ptr->str());
87 if ( (
info.debuglevel_ < 0) || (
info.debuglevel_ > 99) ) {
93 << debuglevel_ptr->intValue()
94 <<
", expected 0-99 ("
95 << debuglevel_ptr->getPosition() <<
")");
104 info.debuglevel_ = 99;
110 if (output_options && deprecated_output_options) {
111 isc_throw(
BadValue,
"Only one of 'output-options' and 'output_options' may be specified.");
114 if (deprecated_output_options) {
116 output_options = deprecated_output_options;
117 ElementPtr mutable_element = boost::const_pointer_cast<Element>(entry);
118 mutable_element->remove(
"output_options");
119 mutable_element->set(
"output-options", output_options);
122 if (output_options) {
123 parseOutputOptions(
info.destinations_, output_options);
126 config_->addLoggingInfo(info);
129void LogConfigParser::parseOutputOptions(std::vector<LoggingDestination>& destination,
131 if (!output_options) {
135 for (
auto const& output_option : output_options->listValue()) {
137 LoggingDestination dest;
142 "element (" << output_option->getPosition() <<
")");
144 dest.output_ = output->stringValue();
148 dest.maxver_ = boost::lexical_cast<int>(maxver_ptr->str());
153 dest.maxsize_ = boost::lexical_cast<uint64_t>(maxsize_ptr->str());
158 dest.flush_ = flush_ptr->boolValue();
163 dest.pattern_ = pattern->stringValue();
166 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.
#define LOG_WARN(LOGGER, MESSAGE)
Macro to conveniently test warn output and log it.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
isc::log::Severity getSeverity(const std::string &sev_str)
Returns the isc::log::Severity value represented by the given string.
isc::log::Logger dctl_logger("dctl")
Defines the logger used within libkea-process library.
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.
const isc::log::MessageID DCTL_DEPRECATED_OUTPUT_OPTIONS
Defines the logger used by the top-level component of kea-lfc.