Kea  1.9.9-git
logger_level.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 <log/logger_level.h>
10 #include <log/macros.h>
11 #include <log/log_messages.h>
12 
13 #include <boost/algorithm/string.hpp>
14 
15 
16 namespace isc {
17 namespace log {
18 
20 getSeverity(const std::string& sev_str) {
21  if (boost::iequals(sev_str, "DEBUG")) {
22  return isc::log::DEBUG;
23  } else if (boost::iequals(sev_str, "INFO")) {
24  return isc::log::INFO;
25  } else if (boost::iequals(sev_str, "WARN")) {
26  return isc::log::WARN;
27  } else if (boost::iequals(sev_str, "ERROR")) {
28  return isc::log::ERROR;
29  } else if (boost::iequals(sev_str, "FATAL")) {
30  return isc::log::FATAL;
31  } else if (boost::iequals(sev_str, "NONE")) {
32  return isc::log::NONE;
33  } else {
34  Logger logger("log");
35  LOG_ERROR(logger, LOG_BAD_SEVERITY).arg(sev_str);
36  return isc::log::INFO;
37  }
38 }
39 
40 
41 } // namespace log
42 } // namespace isc
Logger Class.
Definition: log/logger.h:141
isc::log::Severity getSeverity(const std::string &sev_str)
Returns the isc::log::Severity value represented by the given string.
Definition: logger_level.cc:20
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
Definition: macros.h:32
Severity
Severity Levels.
Definition: logger_level.h:23
const isc::log::MessageID LOG_BAD_SEVERITY
Definition: log_messages.h:12
Defines the logger used by the top-level component of kea-dhcp-ddns.
isc::log::Logger logger("asiodns")
Use the ASIO logger.