mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
[svn r5] Initial commit. Most things are very rough.
This commit is contained in:
48
gen/logger.h
Normal file
48
gen/logger.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#ifndef _llvmd_gen_logger_h_
|
||||
#define _llvmd_gen_logger_h_
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace Logger
|
||||
{
|
||||
#ifndef LLVMD_NO_LOGGER
|
||||
void indent();
|
||||
void undent();
|
||||
std::ostream& cout();
|
||||
void println(const char* fmt,...);
|
||||
void print(const char* fmt,...);
|
||||
#else
|
||||
inline void indent() {}
|
||||
inline void undent() {}
|
||||
inline std::ostream& cout() { return std::cout; }
|
||||
inline void println(const char* fmt, ...) {}
|
||||
inline void print(const char* fmt, ...) {}
|
||||
#endif
|
||||
|
||||
struct LoggerScope
|
||||
{
|
||||
LoggerScope()
|
||||
{
|
||||
#ifndef LLVMD_NO_LOGGER
|
||||
//std::cout << "-->indented\n";
|
||||
Logger::indent();
|
||||
#endif
|
||||
|
||||
}
|
||||
~LoggerScope()
|
||||
{
|
||||
#ifndef LLVMD_NO_LOGGER
|
||||
//std::cout << "<--undented\n";
|
||||
Logger::undent();
|
||||
#endif
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#ifndef LLVMD_NO_LOGGER
|
||||
#define LOG_SCOPE Logger::LoggerScope _logscope;
|
||||
#else
|
||||
#define LOG_SCOPE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user