From dbd117ea62a1529bc43fd74c4484d1369f0e4691 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 30 Sep 2019 16:06:34 -0400 Subject: [PATCH] Include rack:: namespace in APP and logger macros (DEBUG, INFO, WARN, FATAL). --- include/app.hpp | 2 +- include/logger.hpp | 8 ++++---- include/rack.hpp | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/app.hpp b/include/app.hpp index 3304b3db..84fd5760 100644 --- a/include/app.hpp +++ b/include/app.hpp @@ -49,7 +49,7 @@ void appDestroy(); App* appGet(); /** Accesses the global App pointer */ -#define APP appGet() +#define APP rack::appGet() } // namespace rack diff --git a/include/logger.hpp b/include/logger.hpp index 9e94bfea..cf356019 100644 --- a/include/logger.hpp +++ b/include/logger.hpp @@ -9,10 +9,10 @@ will print something like [0.123 debug myfile.cpp:45] error: 67 */ -#define DEBUG(format, ...) logger::log(rack::logger::DEBUG_LEVEL, __FILE__, __LINE__, format, ##__VA_ARGS__) -#define INFO(format, ...) logger::log(rack::logger::INFO_LEVEL, __FILE__, __LINE__, format, ##__VA_ARGS__) -#define WARN(format, ...) logger::log(rack::logger::WARN_LEVEL, __FILE__, __LINE__, format, ##__VA_ARGS__) -#define FATAL(format, ...) logger::log(rack::logger::FATAL_LEVEL, __FILE__, __LINE__, format, ##__VA_ARGS__) +#define DEBUG(format, ...) rack::logger::log(rack::logger::DEBUG_LEVEL, __FILE__, __LINE__, format, ##__VA_ARGS__) +#define INFO(format, ...) rack::logger::log(rack::logger::INFO_LEVEL, __FILE__, __LINE__, format, ##__VA_ARGS__) +#define WARN(format, ...) rack::logger::log(rack::logger::WARN_LEVEL, __FILE__, __LINE__, format, ##__VA_ARGS__) +#define FATAL(format, ...) rack::logger::log(rack::logger::FATAL_LEVEL, __FILE__, __LINE__, format, ##__VA_ARGS__) namespace rack { diff --git a/include/rack.hpp b/include/rack.hpp index 59f03910..eaec8ab3 100644 --- a/include/rack.hpp +++ b/include/rack.hpp @@ -112,6 +112,9 @@ namespace rack { using plugin::Model; using namespace engine; using namespace componentlibrary; + + // Import namespace recursively to solve the problem of calling `rack::DEBUG(...)` which expands to `rack::rack::logger(...)`. + namespace rack = rack; #endif