Raspberry Cloud
Logger.h
1 
7 #ifndef _LOGGER_H
8 #define _LOGGER_H
9 
10 #include<string>
11 #include<iostream>
12 
13 #ifdef _WIN32
14 #define __func__ __FUNCTION__
15 #endif
16 
20 #define LOG_ENTER_EXIT Logger _logger_(__func__)
21 
22 class Logger {
23  static const std::string _in;
24  static const std::string _out;
25  static const char _indentChar;
26 
27  static unsigned int _level;
28 
29  std::string _name;
30 
31 public:
32 
33  Logger(std::string name) : _name(name) {
34  std::cout << std::string(_level++ * 2, _indentChar) << _in << _name << "\n";
35  }
36 
37  ~Logger() {
38  std::cout << std::string(--_level * 2, _indentChar) << _out << _name << "\n";
39  }
40 };
41 #endif //_LOGGER_H
Definition: Logger.h:22