spdlog/tests/test_stdout_api.cpp

74 lines
2.0 KiB
C++
Raw Normal View History

2019-06-20 06:02:54 +08:00
/*
* This content is released under the MIT License as specified in
* https://raw.githubusercontent.com/gabime/spdlog/master/LICENSE
2019-06-20 06:02:54 +08:00
*/
#include "includes.h"
#include "spdlog/sinks/stdout_sinks.h"
#include "spdlog/sinks/stdout_color_sinks.h"
TEST_CASE("stdout_st", "[stdout]") {
2019-06-20 06:02:54 +08:00
auto l = spdlog::stdout_logger_st("test");
l->set_pattern("%+");
l->set_level(spdlog::level::trace);
2019-06-20 06:02:54 +08:00
l->trace("Test stdout_st");
spdlog::drop_all();
}
TEST_CASE("stdout_mt", "[stdout]") {
2019-06-20 06:02:54 +08:00
auto l = spdlog::stdout_logger_mt("test");
l->set_pattern("%+");
l->set_level(spdlog::level::debug);
2019-06-20 06:02:54 +08:00
l->debug("Test stdout_mt");
spdlog::drop_all();
}
TEST_CASE("stderr_st", "[stderr]") {
2019-06-20 06:02:54 +08:00
auto l = spdlog::stderr_logger_st("test");
l->set_pattern("%+");
l->info("Test stderr_st");
spdlog::drop_all();
}
TEST_CASE("stderr_mt", "[stderr]") {
2019-06-20 06:02:54 +08:00
auto l = spdlog::stderr_logger_mt("test");
l->set_pattern("%+");
l->info("Test stderr_mt");
l->warn("Test stderr_mt");
l->error("Test stderr_mt");
l->critical("Test stderr_mt");
spdlog::drop_all();
}
// color loggers
TEST_CASE("stdout_color_st", "[stdout]") {
2019-06-20 06:02:54 +08:00
auto l = spdlog::stdout_color_st("test");
l->set_pattern("%+");
l->info("Test stdout_color_st");
spdlog::drop_all();
}
TEST_CASE("stdout_color_mt", "[stdout]") {
2019-06-20 06:02:54 +08:00
auto l = spdlog::stdout_color_mt("test");
l->set_pattern("%+");
l->set_level(spdlog::level::trace);
2019-06-20 06:02:54 +08:00
l->trace("Test stdout_color_mt");
spdlog::drop_all();
}
TEST_CASE("stderr_color_st", "[stderr]") {
2019-06-20 06:02:54 +08:00
auto l = spdlog::stderr_color_st("test");
l->set_pattern("%+");
l->set_level(spdlog::level::debug);
2019-06-20 06:02:54 +08:00
l->debug("Test stderr_color_st");
spdlog::drop_all();
}
TEST_CASE("stderr_color_mt", "[stderr]") {
2019-06-20 06:02:54 +08:00
auto l = spdlog::stderr_color_mt("test");
l->set_pattern("%+");
l->info("Test stderr_color_mt");
l->warn("Test stderr_color_mt");
l->error("Test stderr_color_mt");
l->critical("Test stderr_color_mt");
spdlog::drop_all();
2019-09-23 17:06:21 +08:00
}