Kea  1.5.0
output_option.cc
Go to the documentation of this file.
1 // Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #include <config.h>
8 
9 #include <string>
10 
11 #include <boost/algorithm/string.hpp>
12 
13 #include <log/log_messages.h>
14 #include <log/macros.h>
15 #include <log/output_option.h>
16 
17 namespace isc {
18 namespace log {
19 
21 getDestination(const std::string& dest_str) {
22  if (boost::iequals(dest_str, "console")) {
24  } else if (boost::iequals(dest_str, "file")) {
26  } else if (boost::iequals(dest_str, "syslog")) {
28  } else {
29  Logger logger("log");
30  LOG_ERROR(logger, LOG_BAD_DESTINATION).arg(dest_str);
32  }
33 }
34 
36 getStream(const std::string& stream_str) {
37  if (boost::iequals(stream_str, "stderr")) {
39  } else if (boost::iequals(stream_str, "stdout")) {
41  } else {
42  Logger logger("log");
43  LOG_ERROR(logger, LOG_BAD_STREAM).arg(stream_str);
45  }
46 }
47 
48 } // namespace log
49 } // namespace isc
output_option.h
isc::log::Logger
Logger Class.
Definition: log/logger.h:143
LOG_ERROR
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
Definition: macros.h:32
isc::log::OutputOption::Destination
Destination
Destinations.
Definition: output_option.h:41
macros.h
isc::log::LOG_BAD_DESTINATION
const isc::log::MessageID LOG_BAD_DESTINATION
Definition: log_messages.h:11
isc
Defines the logger used by the top-level component of kea-dhcp-ddns.
Definition: agent_parser.cc:144
isc::log::getStream
OutputOption::Stream getStream(const std::string &stream_str)
Definition: output_option.cc:36
isc::log::OutputOption::DEST_FILE
@ DEST_FILE
Definition: output_option.h:43
isc::asiodns::logger
isc::log::Logger logger("asiodns")
Use the ASIO logger.
Definition: asiodns/logger.h:15
isc::log::OutputOption::STR_STDERR
@ STR_STDERR
Definition: output_option.h:50
isc::log::OutputOption::Stream
Stream
If console, stream on which messages are output.
Definition: output_option.h:48
isc::log::OutputOption::STR_STDOUT
@ STR_STDOUT
Definition: output_option.h:49
isc::log::getDestination
OutputOption::Destination getDestination(const std::string &dest_str)
Definition: output_option.cc:21
isc::log::OutputOption::DEST_CONSOLE
@ DEST_CONSOLE
Definition: output_option.h:42
isc::log::OutputOption::DEST_SYSLOG
@ DEST_SYSLOG
Definition: output_option.h:44
isc::log::LOG_BAD_STREAM
const isc::log::MessageID LOG_BAD_STREAM
Definition: log_messages.h:13
log_messages.h