This commit is contained in:
gabime
2019-10-09 21:41:02 +03:00
parent 1549ff12f1
commit 9369fe8c27
4 changed files with 23 additions and 1 deletions

View File

@@ -39,3 +39,13 @@ TEST_CASE("disable param evaluation", "[macros]")
{
SPDLOG_TRACE("Test message {}", throw std::runtime_error("Should not be evaluated"));
}
// ensure that even if right macro level is on- don't eavluate if the logger's level is not high enough
TEST_CASE("disable param evaluation2", "[macros]")
{
auto logger = std::make_shared<spdlog::logger>("test-macro");
logger->set_level(spdlog::level::off);
int x = 0;
SPDLOG_LOGGER_DEBUG(logger, "Test message {}", ++x);
REQUIRE(x == 0);
}