CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
54 lines
1.8 KiB
C++
54 lines
1.8 KiB
C++
/*
|
|
* This content is released under the MIT License as specified in
|
|
* https://raw.githubusercontent.com/gabime/spdlog/master/LICENSE
|
|
*/
|
|
|
|
#include "includes.h"
|
|
|
|
#if SPDLOG_ACTIVE_LEVEL != SPDLOG_LEVEL_DEBUG
|
|
#error "Invalid SPDLOG_ACTIVE_LEVEL in test. Should be SPDLOG_LEVEL_DEBUG"
|
|
#endif
|
|
|
|
#define TEST_FILENAME "test_logs/simple_log"
|
|
|
|
TEST_CASE("debug and trace w/o format string", "[macros]") {
|
|
prepare_logdir();
|
|
spdlog::filename_t filename = SPDLOG_FILENAME_T(TEST_FILENAME);
|
|
|
|
auto logger = spdlog::create<spdlog::sinks::basic_file_sink_mt>("logger", filename);
|
|
logger->set_pattern("%v");
|
|
logger->set_level(spdlog::level::trace);
|
|
|
|
SPDLOG_LOGGER_TRACE(logger, "Test message 1");
|
|
SPDLOG_LOGGER_DEBUG(logger, "Test message 2");
|
|
logger->flush();
|
|
|
|
using spdlog::details::os::default_eol;
|
|
REQUIRE(ends_with(file_contents(TEST_FILENAME),
|
|
spdlog::fmt_lib::format("Test message 2{}", default_eol)));
|
|
REQUIRE(count_lines(TEST_FILENAME) == 1);
|
|
|
|
auto orig_default_logger = spdlog::default_logger();
|
|
spdlog::set_default_logger(logger);
|
|
|
|
SPDLOG_TRACE("Test message 3");
|
|
SPDLOG_DEBUG("Test message {}", 4);
|
|
logger->flush();
|
|
|
|
require_message_count(TEST_FILENAME, 2);
|
|
REQUIRE(ends_with(file_contents(TEST_FILENAME),
|
|
spdlog::fmt_lib::format("Test message 4{}", default_eol)));
|
|
spdlog::set_default_logger(std::move(orig_default_logger));
|
|
}
|
|
|
|
TEST_CASE("disable param evaluation", "[macros]") {
|
|
SPDLOG_TRACE("Test message {}", throw std::runtime_error("Should not be evaluated"));
|
|
}
|
|
|
|
TEST_CASE("pass logger pointer", "[macros]") {
|
|
auto logger = spdlog::create<spdlog::sinks::null_sink_mt>("refmacro");
|
|
auto &ref = *logger;
|
|
SPDLOG_LOGGER_TRACE(&ref, "Test message 1");
|
|
SPDLOG_LOGGER_DEBUG(&ref, "Test message 2");
|
|
}
|