18static const std::string STDOUT =
"stdout";
19static const std::string STDERR =
"stderr";
20static const std::string SYSLOG =
"syslog";
21static const std::string SYSLOG_COLON =
"syslog:";
37 result->set(
"output", Element::create(
output_));
40 result->set(
"flush", Element::create(
flush_));
43 result->set(
"pattern", Element::create(
pattern_));
46 (
output_.find(SYSLOG_COLON) == std::string::npos)) {
48 result->set(
"maxver", Element::create(
maxver_));
51 result->set(
"maxsize", Element::create(
static_cast<long long>(
maxsize_)));
58 :
name_(
"kea"), severity_(
isc::log::
INFO), debuglevel_(0) {
69 if (!default_logger.empty()) {
70 name_ = default_logger;
92 if (dest.equals(dest_other)) {
117 if (dest.output_ == STDOUT) {
119 option.
stream = OutputOption::STR_STDOUT;
121 }
else if (dest.output_ == STDERR) {
123 option.
stream = OutputOption::STR_STDERR;
125 }
else if (dest.output_ == SYSLOG) {
130 }
else if (dest.output_.find(SYSLOG_COLON) == 0) {
133 if (dest.output_ == SYSLOG_COLON) {
140 option.
facility = dest.output_.substr(SYSLOG_COLON.size());
147 option.
maxsize = dest.maxsize_;
148 option.
maxver = dest.maxver_;
152 option.
flush = dest.flush_;
155 option.
pattern = dest.pattern_;
170 result->set(
"name", Element::create(
name_));
175 options->add(dest.toElement());
177 result->set(
"output_options", options);
180 std::string severity;
204 result->set(
"severity", Element::create(severity));
206 result->set(
"debuglevel", Element::create(
debuglevel_));
void addOutputOption(const OutputOption &option)
Add output option.
static bool getVerbose()
Returns if running in verbose mode.
static std::string getDefaultLoggerName()
Returns default logger name.
structure that describes one logging entry
LoggingInfo()
Default constructor.
int debuglevel_
debuglevel (used when severity_ == DEBUG)
bool equals(const LoggingInfo &other) const
Compares two objects for equality.
isc::log::LoggerSpecification toSpec() const
Converts logger configuration to a spec.
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
std::string name_
logging name
std::vector< LoggingDestination > destinations_
specific logging destinations
isc::log::Severity severity_
describes logging severity
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< Element > ElementPtr
const std::string & getDefaultRootLoggerName()
Returns the default ('kea') root logger name.
Defines the logger used by the top-level component of kea-lfc.
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.
Destination destination
Members.
std::string pattern
log content pattern
bool flush
true to flush after each message
unsigned int maxver
Maximum versions (none if <= 0)
std::string facility
syslog facility
uint64_t maxsize
0 if no maximum size
Stream stream
stdout/stderr if console output
std::string filename
Filename if file output.
Defines single logging destination.
int maxver_
Maximum number of log files in rotation.
std::string output_
defines logging destination output
std::string pattern_
defines the log format pattern It dictates what additional elements are output
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
bool equals(const LoggingDestination &other) const
Compares two objects for equality.
uint64_t maxsize_
Maximum log file size.
bool flush_
Immediate flush.