28 LoggingDestination::toElement()
const {
32 result->set(
"output", Element::create(
output_));
34 result->set(
"maxver", Element::create(maxver_));
36 result->set(
"maxsize", Element::create(static_cast<long long>(maxsize_)));
38 result->set(
"flush", Element::create(flush_));
40 result->set(
"pattern", Element::create(pattern_));
45 LoggingInfo::LoggingInfo()
46 :
name_(
"kea"), severity_(
isc::log::
INFO), debuglevel_(0) {
57 if (!default_logger.empty()) {
58 name_ = default_logger;
77 for (std::vector<LoggingDestination>::const_iterator
82 for (std::vector<LoggingDestination>::const_iterator
86 if (it_this->equals(*it_other)) {
105 static const std::string STDOUT =
"stdout";
106 static const std::string STDERR =
"stderr";
107 static const std::string SYSLOG =
"syslog";
108 static const std::string SYSLOG_COLON =
"syslog:";
113 for (std::vector<LoggingDestination>::const_iterator dest =
118 if (dest->output_ == STDOUT) {
120 option.
stream = OutputOption::STR_STDOUT;
122 }
else if (dest->output_ == STDERR) {
124 option.
stream = OutputOption::STR_STDERR;
126 }
else if (dest->output_ == SYSLOG) {
131 }
else if (dest->output_.find(SYSLOG_COLON) == 0) {
134 if (dest->output_ == SYSLOG_COLON) {
141 option.
facility = dest->output_.substr(SYSLOG_COLON.size());
148 option.
maxsize = dest->maxsize_;
149 option.
maxver = dest->maxver_;
153 option.
flush = dest->flush_;
156 option.
pattern = dest->pattern_;
171 result->set(
"name", Element::create(
name_));
175 for (std::vector<LoggingDestination>::const_iterator dest =
178 options->add(dest->toElement());
180 result->set(
"output_options", options);
183 std::string severity;
207 result->set(
"severity", Element::create(severity));
209 result->set(
"debuglevel", Element::create(
debuglevel_));
void addOutputOption(const OutputOption &option)
Add output option.
size_t maxsize
0 if no maximum size
const std::string & getDefaultRootLoggerName()
Returns the default ('kea') root logger name.
bool flush
true to flush after each message
static std::string getDefaultLoggerName()
Returns default logger name.
std::vector< LoggingDestination > destinations_
specific logging destinations
boost::shared_ptr< Element > ElementPtr
bool equals(const LoggingInfo &other) const
Compares two objects for equality.
Stream stream
stdout/stderr if console output
structure that describes one logging entry
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.
isc::log::LoggerSpecification toSpec() const
Converts logger configuration to a spec.
std::string pattern_
defines the log format pattern It dictates what additional elements are output
std::string facility
syslog facility
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
std::string output_
defines logging destination output
std::string pattern
log content pattern
uint64_t maxsize_
Maximum log file size.
Destination destination
Members.
Defines single logging destination.
Defines the logger used by the top-level component of kea-dhcp-ddns.
unsigned int maxver
Maximum versions (none if <= 0)
static bool getVerbose()
Returns if running in verbose mode.
isc::log::Severity severity_
describes logging severity
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
int debuglevel_
debuglevel (used when severity_ == DEBUG)
std::string name_
logging name
std::string filename
Filename if file output.
int maxver_
Maximum number of log files in rotation.
bool flush_
Immediate flush.