renamed macros to decrease name collision probability

This commit is contained in:
Bob Polis 2020-04-29 17:12:22 +02:00
parent fc65a743eb
commit 0173d1fe10
2 changed files with 11 additions and 11 deletions

View File

@ -74,10 +74,10 @@ namespace sc {
} }
#define _debug(logger, ...) logger.msg(sc::loglevel::debug, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) #define SCDebug(logger, ...) logger.msg(sc::loglevel::debug, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
#define _info(logger, ...) logger.msg(sc::loglevel::info, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) #define SCInfo(logger, ...) logger.msg(sc::loglevel::info, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
#define _warning(logger, ...) logger.msg(sc::loglevel::warning, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) #define SCWarning(logger, ...) logger.msg(sc::loglevel::warning, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
#define _error(logger, ...) logger.msg(sc::loglevel::error, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) #define SCError(logger, ...) logger.msg(sc::loglevel::error, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
#define _critical(logger, ...) logger.msg(sc::loglevel::critical, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) #define SCCritical(logger, ...) logger.msg(sc::loglevel::critical, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
#endif // _logger_H_ #endif // _logger_H_

View File

@ -60,12 +60,12 @@ int main(int argc, const char * argv[]) {
} }
std::cout << "hello, tester\n"; std::cout << "hello, tester\n";
sc::logger logger("tester", sc::loglevel::debug); sc::logger logger("tester", sc::loglevel::debug);
_debug(logger, "efkes proberen"); SCDebug(logger, "efkes proberen");
_info(logger, 42, " = ", 6, " x ", 7); SCInfo(logger, 42, " = ", 6, " x ", 7);
_warning(logger, "laatste waarschuwing"); SCWarning(logger, "laatste waarschuwing");
_error(logger, "foutje, bedankt"); SCError(logger, "foutje, bedankt");
_critical(logger, "meltdown imminent"); SCCritical(logger, "meltdown imminent");
_info(logger, ""); SCInfo(logger, "");
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
std::cerr << "tester: " << ex.what() << '\n'; std::cerr << "tester: " << ex.what() << '\n';
return EXIT_FAILURE; return EXIT_FAILURE;