LCOV - code coverage report
Current view: top level - log - logger_level.cc (source / functions) Hit Total Coverage
Test: report.info Lines: 10 10 100.0 %
Date: 2012-05-15 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 21 32 65.6 %

           Branch data     Line data    Source code
       1                 :            : // Copyright (C) 2011  Internet Systems Consortium, Inc. ("ISC")
       2                 :            : //
       3                 :            : // Permission to use, copy, modify, and/or distribute this software for any
       4                 :            : // purpose with or without fee is hereby granted, provided that the above
       5                 :            : // copyright notice and this permission notice appear in all copies.
       6                 :            : //
       7                 :            : // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
       8                 :            : // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
       9                 :            : // AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
      10                 :            : // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
      11                 :            : // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
      12                 :            : // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
      13                 :            : // PERFORMANCE OF THIS SOFTWARE
      14                 :            : 
      15                 :            : #include <log/logger_level.h>
      16                 :            : #include <log/macros.h>
      17                 :            : #include <log/log_messages.h>
      18                 :            : 
      19                 :            : #include <boost/algorithm/string.hpp>
      20                 :            : 
      21                 :            : 
      22                 :            : namespace isc {
      23                 :            : namespace log {
      24                 :            : 
      25                 :            : isc::log::Severity
      26                 :        132 : getSeverity(const std::string& sev_str) {
      27 [ +  - ][ +  + ]:        132 :     if (boost::iequals(sev_str, "DEBUG")) {
      28                 :            :         return isc::log::DEBUG;
      29 [ +  - ][ +  + ]:        112 :     } else if (boost::iequals(sev_str, "INFO")) {
      30                 :            :         return isc::log::INFO;
      31 [ +  - ][ +  + ]:         31 :     } else if (boost::iequals(sev_str, "WARN")) {
      32                 :            :         return isc::log::WARN;
      33 [ +  - ][ +  + ]:         22 :     } else if (boost::iequals(sev_str, "ERROR")) {
      34                 :            :         return isc::log::ERROR;
      35 [ +  - ][ +  + ]:         11 :     } else if (boost::iequals(sev_str, "FATAL")) {
      36                 :            :         return isc::log::FATAL;
      37 [ +  - ][ +  - ]:          2 :     } else if (boost::iequals(sev_str, "NONE")) {
      38                 :            :         return isc::log::NONE;
      39                 :            :     } else {
      40                 :        132 :         Logger logger("log");
      41 [ +  - ][ +  - ]:          4 :         LOG_ERROR(logger, LOG_BAD_SEVERITY).arg(sev_str);
         [ +  - ][ +  - ]
      42                 :            :         return isc::log::INFO;
      43                 :            :     }
      44                 :            : }
      45                 :            : 
      46                 :            : 
      47                 :            : } // namespace log
      48                 :        141 : } // namespace isc

Generated by: LCOV version 1.9