mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-26 10:31:34 +08:00
166843ff3a
Some checks failed
linux / ${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }} ${{ matrix.config.build_type }} ${{ matrix.config.asan == 'ON' && 'ASAN' || '' }}${{ matrix.config.tsan == 'ON' && 'TSAN' || '' }}) (map[asan:ON build_type:Debug … (push) Has been cancelled
linux / ${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }} ${{ matrix.config.build_type }} ${{ matrix.config.asan == 'ON' && 'ASAN' || '' }}${{ matrix.config.tsan == 'ON' && 'TSAN' || '' }}) (map[build_type:Debug compiler… (push) Has been cancelled
linux / ${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }} ${{ matrix.config.build_type }} ${{ matrix.config.asan == 'ON' && 'ASAN' || '' }}${{ matrix.config.tsan == 'ON' && 'TSAN' || '' }}) (map[build_type:Release compil… (push) Has been cancelled
macos / macOS Clang (C++17, Release) (push) Has been cancelled
windows / build (map[BUILD_EXAMPLE:OFF BUILD_SHARED:ON BUILD_TYPE:Release CXX_STANDARD:17 FATAL_ERRORS:ON GENERATOR:Visual Studio 17 2022]) (push) Has been cancelled
windows / build (map[BUILD_EXAMPLE:OFF BUILD_SHARED:ON BUILD_TYPE:Release CXX_STANDARD:20 FATAL_ERRORS:ON GENERATOR:Visual Studio 17 2022]) (push) Has been cancelled
windows / build (map[BUILD_EXAMPLE:ON BUILD_SHARED:OFF BUILD_TYPE:Release CXX_STANDARD:17 FATAL_ERRORS:ON GENERATOR:Visual Studio 17 2022]) (push) Has been cancelled
windows / build_2019 (map[BUILD_EXAMPLE:ON BUILD_SHARED:ON BUILD_TYPE:Release CXX_STANDARD:17 FATAL_ERRORS:ON GENERATOR:Visual Studio 16 2019]) (push) Has been cancelled
windows / build_2019 (map[BUILD_EXAMPLE:ON BUILD_SHARED:ON BUILD_TYPE:Release CXX_STANDARD:20 FATAL_ERRORS:ON GENERATOR:Visual Studio 16 2019]) (push) Has been cancelled
Removed registry
84 lines
2.5 KiB
C++
84 lines
2.5 KiB
C++
/*
|
|
* This content is released under the MIT License as specified in
|
|
* https://raw.githubusercontent.com/gabime/spdlog/v2.x/LICENSE
|
|
*/
|
|
#include "includes.h"
|
|
#include "spdlog/sinks/stdout_color_sinks.h"
|
|
#include "spdlog/sinks/stdout_sinks.h"
|
|
|
|
TEST_CASE("stdout_st", "[stdout]") {
|
|
spdlog::set_pattern("%+");
|
|
auto l = spdlog::stdout_logger_st("test");
|
|
l->set_level(spdlog::level::trace);
|
|
l->trace("Test stdout_st");
|
|
l->debug("Test stdout_st");
|
|
l->info("Test stdout_st");
|
|
l->warn("Test stdout_st");
|
|
l->error("Test stdout_st");
|
|
l->critical("Test stdout_st");
|
|
}
|
|
|
|
TEST_CASE("stderr_st", "[stderr]") {
|
|
auto l = spdlog::stderr_logger_st("test");
|
|
l->set_level(spdlog::level::trace);
|
|
l->trace("Test stderr_st");
|
|
l->debug("Test stderr_st");
|
|
l->info("Test stderr_st");
|
|
l->warn("Test stderr_st");
|
|
l->error("Test stderr_st");
|
|
l->critical("Test stderr_st");
|
|
}
|
|
|
|
TEST_CASE("stdout_mt", "[stdout]") {
|
|
auto sink = std::make_shared<spdlog::sinks::stdout_sink_mt>();
|
|
spdlog::logger logger("logger", sink);
|
|
logger.debug("Test stdout_mt should not be displayed !!!!");
|
|
}
|
|
|
|
TEST_CASE("stderr_mt", "[stderr]") {
|
|
auto sink = std::make_shared<spdlog::sinks::stderr_sink_mt>();
|
|
spdlog::logger logger("logger", sink);
|
|
logger.debug("Test stderr_mt should not be displayed !!!!");
|
|
}
|
|
|
|
// color loggers
|
|
TEST_CASE("stdout_color_st", "[stdout]") {
|
|
auto l = spdlog::stdout_color_st("test");
|
|
l->set_pattern("%+");
|
|
l->set_level(spdlog::level::trace);
|
|
l->trace("Test stdout_color_st");
|
|
l->debug("Test stdout_color_st");
|
|
l->info("Test stdout_color_st");
|
|
l->warn("Test stdout_color_st");
|
|
l->error("Test stdout_color_st");
|
|
l->critical("Test stdout_color_st");
|
|
}
|
|
|
|
TEST_CASE("stdout_color_mt", "[stdout]") {
|
|
auto l = spdlog::stdout_color_mt("test");
|
|
l->set_pattern("%+");
|
|
l->set_level(spdlog::level::trace);
|
|
l->trace("Test stdout_color_mt");
|
|
l->debug("Test stdout_color_mt");
|
|
l->info("Test stdout_color_mt");
|
|
l->warn("Test stdout_color_mt");
|
|
l->error("Test stdout_color_mt");
|
|
l->critical("Test stdout_color_mt");
|
|
}
|
|
|
|
TEST_CASE("stderr_color_st", "[stderr]") {
|
|
auto l = spdlog::stderr_color_st("test");
|
|
l->set_pattern("%+");
|
|
l->set_level(spdlog::level::debug);
|
|
l->debug("Test stderr_color_st");
|
|
}
|
|
|
|
TEST_CASE("stderr_color_mt", "[stderr]") {
|
|
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");
|
|
}
|