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