mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-28 17:19:34 +08:00
Fix build errors
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
#include "spdlog/sinks/basic_file_sink.h"
|
||||
#include "test_sink.h"
|
||||
|
||||
#define TEST_FILENAME "test_logs/async_test.log"
|
||||
|
||||
TEST_CASE("basic async test ", "[async]")
|
||||
{
|
||||
auto test_sink = std::make_shared<spdlog::sinks::test_sink_mt>();
|
||||
@@ -149,7 +151,7 @@ TEST_CASE("to_file", "[async]")
|
||||
prepare_logdir();
|
||||
size_t messages = 1024;
|
||||
size_t tp_threads = 1;
|
||||
std::string filename = "test_logs/async_test.log";
|
||||
spdlog::filename_t filename = SPDLOG_FILENAME_T(TEST_FILENAME);
|
||||
{
|
||||
auto file_sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(filename, true);
|
||||
auto tp = std::make_shared<spdlog::details::thread_pool>(messages, tp_threads);
|
||||
@@ -161,8 +163,8 @@ TEST_CASE("to_file", "[async]")
|
||||
}
|
||||
}
|
||||
|
||||
require_message_count(filename, messages);
|
||||
auto contents = file_contents(filename);
|
||||
require_message_count(TEST_FILENAME, messages);
|
||||
auto contents = file_contents(TEST_FILENAME);
|
||||
using spdlog::details::os::default_eol;
|
||||
REQUIRE(ends_with(contents, fmt::format("Hello message #1023{}", default_eol)));
|
||||
}
|
||||
@@ -172,7 +174,7 @@ TEST_CASE("to_file multi-workers", "[async]")
|
||||
prepare_logdir();
|
||||
size_t messages = 1024 * 10;
|
||||
size_t tp_threads = 10;
|
||||
std::string filename = "test_logs/async_test.log";
|
||||
spdlog::filename_t filename = SPDLOG_FILENAME_T(TEST_FILENAME);
|
||||
{
|
||||
auto file_sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(filename, true);
|
||||
auto tp = std::make_shared<spdlog::details::thread_pool>(messages, tp_threads);
|
||||
@@ -184,5 +186,5 @@ TEST_CASE("to_file multi-workers", "[async]")
|
||||
}
|
||||
}
|
||||
|
||||
require_message_count(filename, messages);
|
||||
require_message_count(TEST_FILENAME, messages);
|
||||
}
|
||||
|
Reference in New Issue
Block a user