This commit is contained in:
gabime 2016-08-20 13:55:50 +03:00
parent efc8de6d64
commit 4efbd950d6
5 changed files with 36 additions and 29 deletions

View File

@ -80,7 +80,10 @@ int main(int, char*[])
err_handler_example();
// Apply a function on all registered loggers
spd::apply_all([&](std::shared_ptr<spdlog::logger> l) {l->info("End of example."); });
spd::apply_all([&](std::shared_ptr<spdlog::logger> l)
{
l->info("End of example.");
});
// Release and close all loggers
spdlog::drop_all();

View File

@ -32,7 +32,10 @@ TEST_CASE("apply_all" "[registry]")
spdlog::register_logger(logger2);
int counter = 0;
spdlog::apply_all([&counter](std::shared_ptr<spdlog::logger> l){counter++;});
spdlog::apply_all([&counter](std::shared_ptr<spdlog::logger> l)
{
counter++;
});
REQUIRE(counter == 2);
counter = 0;
@ -40,7 +43,8 @@ TEST_CASE("apply_all" "[registry]")
spdlog::apply_all([&counter](std::shared_ptr<spdlog::logger> l)
{
REQUIRE(l->name() == tested_logger_name);
counter++; }
counter++;
}
);
REQUIRE(counter == 1);
}