UHD 003.004.003-0-unknown

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
log.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2011 Ettus Research LLC
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 //
17
18 #ifndef INCLUDED_UHD_UTILS_LOG_HPP
19 #define INCLUDED_UHD_UTILS_LOG_HPP
20
21 #include <uhd/config.hpp>
22 #include <uhd/utils/pimpl.hpp>
23 #include <boost/current_function.hpp>
24 #include <ostream>
25 #include <string>
26
57 #define UHD_LOGV(verbosity) \
58 uhd::_log::log(uhd::_log::verbosity, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)()
59
64 #define UHD_LOG \
65 UHD_LOGV(regularly)
66
67
68 namespace uhd{ namespace _log{
69
71 enum verbosity_t{
72 always = 1,
73 often = 2,
74 regularly = 3,
75 rarely = 4,
76 very_rarely = 5,
77 never = 6,
78 };
79
81 class UHD_API log{
82 public:
83 log(
84 const verbosity_t verbosity,
85 const std::string &file,
86 const unsigned int line,
87 const std::string &function
88 );
89 ~log(void);
90 std::ostream &operator()(void);
91 private:
92 UHD_PIMPL_DECL(impl) _impl;
93 };
94
95 }} //namespace uhd::_log
96
97 #endif /* INCLUDED_UHD_UTILS_LOG_HPP */