mavtables  0.2.1
MAVLink router and firewall.
Logger.hpp
Go to the documentation of this file.
1 // MAVLink router and firewall.
2 // Copyright (C) 2018 Michael R. Shannon <mrshannon.aerospace@gmail.com>
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 2 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 LOGGER_HPP_
19 #define LOGGER_HPP_
20 
21 
22 #include <mutex>
23 #include <string>
24 
25 
26 /** A global static logger for use by all of mavtables.
27  *
28  * \note Only supports writing to stdout.
29  */
30 class Logger
31 {
32  public:
33  static void log(std::string message);
34  static void log(unsigned int level, std::string message);
35  static void level(unsigned int level);
36  static unsigned int level();
37 
38  private:
39  Logger(const Logger &logger) = delete;
40  void operator=(const Logger &logger) = delete;
41  Logger() = default;
42  static unsigned int level_;
43  static std::mutex mutex_;
44 };
45 
46 
47 #endif // LOGGER_HPP_
static void log(std::string message)
Definition: Logger.cpp:37
Definition: logger.py:1
static unsigned int level()
Definition: Logger.cpp:96