Mercurial > projects > ldc
comparison gen/logger.h @ 38:27b2f40bdb58 trunk
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
Fiddled a bit the the testing system.
Added a very simple SDL graphics demo.
author | lindquist |
---|---|
date | Wed, 10 Oct 2007 06:16:48 +0200 |
parents | c53b6e3fe49a |
children | 61615fa85940 |
comparison
equal
deleted
inserted
replaced
37:77cdca8c210f | 38:27b2f40bdb58 |
---|---|
3 | 3 |
4 #include <iostream> | 4 #include <iostream> |
5 | 5 |
6 namespace Logger | 6 namespace Logger |
7 { | 7 { |
8 #ifndef LLVMD_NO_LOGGER | |
9 void indent(); | 8 void indent(); |
10 void undent(); | 9 void undent(); |
11 std::ostream& cout(); | 10 std::ostream& cout(); |
12 void println(const char* fmt,...); | 11 void println(const char* fmt, ...); |
13 void print(const char* fmt,...); | 12 void print(const char* fmt, ...); |
14 #else | 13 void enable(); |
15 inline void indent() {} | 14 void disable(); |
16 inline void undent() {} | 15 |
17 inline std::ostream& cout() { return std::cout; } | |
18 inline void println(const char* fmt, ...) {} | |
19 inline void print(const char* fmt, ...) {} | |
20 #endif | |
21 | 16 |
22 struct LoggerScope | 17 struct LoggerScope |
23 { | 18 { |
24 LoggerScope() | 19 LoggerScope() |
25 { | 20 { |
26 #ifndef LLVMD_NO_LOGGER | |
27 //std::cout << "-->indented\n"; | |
28 Logger::indent(); | 21 Logger::indent(); |
29 #endif | |
30 | 22 |
31 } | 23 } |
32 ~LoggerScope() | 24 ~LoggerScope() |
33 { | 25 { |
34 #ifndef LLVMD_NO_LOGGER | |
35 //std::cout << "<--undented\n"; | |
36 Logger::undent(); | 26 Logger::undent(); |
37 #endif | |
38 } | 27 } |
39 }; | 28 }; |
40 } | 29 } |
41 | 30 |
42 #ifndef LLVMD_NO_LOGGER | |
43 #define LOG_SCOPE Logger::LoggerScope _logscope; | 31 #define LOG_SCOPE Logger::LoggerScope _logscope; |
44 #else | 32 |
45 #define LOG_SCOPE | |
46 #endif | 33 #endif |
47 | 34 |
48 #endif |