Kea 2.5.8
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
16namespace isc {
17namespace log {
18
20getSeverity(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:142
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
Definition: macros.h:32
const isc::log::MessageID LOG_BAD_SEVERITY
Definition: log_messages.h:12
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
Severity
Severity Levels.
Definition: logger_level.h:23
Defines the logger used by the top-level component of kea-lfc.