18 static const std::string STDOUT =
"stdout";
19 static const std::string STDERR =
"stderr";
20 static const std::string SYSLOG =
"syslog";
21 static const std::string SYSLOG_COLON =
"syslog:";
33 LoggingDestination::toElement()
const {
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_)));
57 LoggingInfo::LoggingInfo()
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.
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
Stream stream
stdout/stderr if console output
isc::log::LoggerSpecification toSpec() const
Converts logger configuration to a spec.
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
structure that describes one logging entry
uint64_t maxsize
0 if no maximum size
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.
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.
Defines the logger used by the top-level component of kea-lfc.
unsigned int maxver
Maximum versions (none if <= 0)
static bool getVerbose()
Returns if running in verbose mode.
isc::log::Severity severity_
describes logging severity
bool equals(const LoggingInfo &other) const
Compares two objects for equality.
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.