NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
logger.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2013-2018 Regents of the University of California.
4
*
5
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6
*
7
* ndn-cxx library is free software: you can redistribute it and/or modify it under the
8
* terms of the GNU Lesser General Public License as published by the Free Software
9
* Foundation, either version 3 of the License, or (at your option) any later version.
10
*
11
* ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14
*
15
* You should have received copies of the GNU General Public License and GNU Lesser
16
* General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17
* <http://www.gnu.org/licenses/>.
18
*
19
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20
*/
21
22
#include "
ndn-cxx/util/logger.hpp
"
23
#include "
ndn-cxx/detail/common.hpp
"
24
25
namespace
ndn
{
26
namespace
util {
27
28
std::ostream&
29
operator<<
(std::ostream& os,
LogLevel
level)
30
{
31
switch
(level) {
32
case
LogLevel::FATAL
:
33
return
os <<
"FATAL"
;
34
case
LogLevel::NONE
:
35
return
os <<
"NONE"
;
36
case
LogLevel::ERROR
:
37
return
os <<
"ERROR"
;
38
case
LogLevel::WARN
:
39
return
os <<
"WARN"
;
40
case
LogLevel::INFO
:
41
return
os <<
"INFO"
;
42
case
LogLevel::DEBUG
:
43
return
os <<
"DEBUG"
;
44
case
LogLevel::TRACE
:
45
return
os <<
"TRACE"
;
46
case
LogLevel::ALL
:
47
return
os <<
"ALL"
;
48
}
49
50
BOOST_THROW_EXCEPTION(std::invalid_argument(
"unknown log level "
+
std::to_string
(static_cast<int>(level))));
51
}
52
53
LogLevel
54
parseLogLevel
(
const
std::string& s)
55
{
56
if
(s ==
"FATAL"
)
57
return
LogLevel::FATAL
;
58
else
if
(s ==
"NONE"
)
59
return
LogLevel::NONE
;
60
else
if
(s ==
"ERROR"
)
61
return
LogLevel::ERROR
;
62
else
if
(s ==
"WARN"
)
63
return
LogLevel::WARN
;
64
else
if
(s ==
"INFO"
)
65
return
LogLevel::INFO
;
66
else
if
(s ==
"DEBUG"
)
67
return
LogLevel::DEBUG
;
68
else
if
(s ==
"TRACE"
)
69
return
LogLevel::TRACE
;
70
else
if
(s ==
"ALL"
)
71
return
LogLevel::ALL
;
72
73
BOOST_THROW_EXCEPTION(std::invalid_argument(
"unrecognized log level '"
+ s +
"'"
));
74
}
75
76
}
// namespace util
77
}
// namespace ndn
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::util::LogLevel::TRACE
trace messages (most verbose)
ndn::util::LogLevel::DEBUG
debug messages
ndn::util::LogLevel::ERROR
serious error messages
ndn::util::operator<<
std::ostream & operator<<(std::ostream &os, LogLevel level)
Output LogLevel as a string.
Definition:
logger.cpp:29
ndn::util::LogLevel::INFO
informational messages
logger.hpp
ndn::util::LogLevel
LogLevel
Indicates the severity level of a log message.
Definition:
logger.hpp:32
common.hpp
import common constructs for ndn-cxx library internal use
ndn::util::LogLevel::ALL
all messages
ndn::util::parseLogLevel
LogLevel parseLogLevel(const std::string &s)
Parse LogLevel from a string.
Definition:
logger.cpp:54
ndn::util::LogLevel::WARN
warning messages
ndn::util::LogLevel::FATAL
fatal (will be logged unconditionally)
ndn::to_string
std::string to_string(const V &v)
Definition:
backports.hpp:67
ndn::util::LogLevel::NONE
no messages
ndnSIM
ndn-cxx
ndn-cxx
util
logger.cpp
Generated on Sun Feb 24 2019 22:16:06 for ndnSIM by
1.8.15