ROSE 0.11.145.147
Logger.h
1#ifndef ROSE_Logger_H
2#define ROSE_Logger_H
3
4#include <map>
5#include <string>
6
7namespace Rose {
8
9#define DEBUG__Rose__Loggers 0
10
12class Logger {
13 public:
14 enum class Level {
15 debug = 0,
16 info = 1,
17 warning = 2,
18 error = 3,
19 fatal = 4,
20 enter = 5, //< Used internally for "Enter: mnenonic(ptr_id)"
21 leave = 6 //< Used internally for "Leave: mnenonic(ptr_id)"
22 };
23
24 private:
26 static std::map<std::string, Logger::Level> mnemonic_to_level;
27
28 static Logger root;
29 static Logger * current;
30
31 static std::string indent;
32 static bool indent_first;
33
34#if DEBUG__Rose__Loggers
36 static std::map<std::string, std::string> mnemonic_to_function;
37#endif
38
40 std::string function;
42 std::string mnemonic;
44 void * ptr_id;
45 Level level;
46
47 Logger * parent;
48 int depth;
49
50 private:
51 void display(Level const lvl, std::string const & message);
52 void display(Level const lvl, const char * format, ...);
53
54 public:
55 Logger();
56 Logger(const char * function_, const char * mnemonic_, void * const ptr_id_, Level const level_);
57
58 ~Logger();
59
60 void debug(const char * format, ...);
61 void info(const char * format, ...);
62 void warning(const char * format, ...);
63 void error(const char * format, ...);
64 void fatal(const char * format, ...);
65};
66
67}
68
69#endif /* ROSE_Logger_H */
A nested logging mechanism to facilitate debbuging of tree traversal.
Definition Logger.h:12
The ROSE library.