10 #include <boost/foreach.hpp> 11 #include <boost/lexical_cast.hpp> 23 LogConfigParser::LogConfigParser(
const ConfigPtr& storage)
24 :config_(storage), verbose_(false) {
27 "configuration, so parsed data can be stored there");
37 parseConfigEntry(logger);
65 "element (" << entry->getPosition() <<
")");
67 info.
name_ = name_ptr->stringValue();
73 "'severity' element (" << entry->getPosition() <<
")");
77 }
catch (
const std::exception&) {
79 << severity_ptr->stringValue() <<
"' (" 80 << severity_ptr->getPosition() <<
")");
91 info.
debuglevel_ = boost::lexical_cast<
int>(debuglevel_ptr->str());
98 << debuglevel_ptr->stringValue()
99 <<
"', expected 0-99 (" 100 << debuglevel_ptr->getPosition() <<
")");
114 if (output_options) {
118 config_->addLoggingInfo(info);
121 void LogConfigParser::parseOutputOptions(std::vector<LoggingDestination>& destination,
123 if (!output_options) {
127 BOOST_FOREACH(
ConstElementPtr output_option, output_options->listValue()) {
134 "element (" << output_option->getPosition() <<
")");
136 dest.
output_ = output->stringValue();
140 dest.
maxver_ = boost::lexical_cast<
int>(maxver_ptr->str());
145 dest.
maxsize_ = boost::lexical_cast<uint64_t>(maxsize_ptr->str());
150 dest.
flush_ = flush_ptr->boolValue();
155 dest.
pattern_ = pattern->stringValue();
158 destination.push_back(dest);
void setContext(const data::ConstElementPtr &ctx)
Sets user context.
isc::log::Severity getSeverity(const std::string &sev_str)
Returns the isc::log::Severity value represented by the given string.
void clearDestinations()
Removes logging destinations.
std::vector< LoggingDestination > destinations_
specific logging destinations
structure that describes one logging entry
std::string pattern_
defines the log format pattern It dictates what additional elements are output
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.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
std::string output_
defines logging destination output
uint64_t maxsize_
Maximum log file size.
Defines single logging destination.
boost::shared_ptr< const Element > ConstElementPtr
Defines the logger used by the top-level component of kea-lfc.
isc::log::Logger logger("asiodns")
Use the ASIO logger.
Logging initialization functions.
isc::log::Severity severity_
describes logging severity
int debuglevel_
debuglevel (used when severity_ == DEBUG)
std::string name_
logging name
int maxver_
Maximum number of log files in rotation.
bool flush_
Immediate flush.
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.