mirror of
https://github.com/gabime/spdlog.git
synced 2025-02-26 18:25:49 +08:00
Removed SPDLOG_FMT_RUNTIME definition
This commit is contained in:
parent
959244b3cd
commit
5782891494
@ -47,15 +47,9 @@
|
|||||||
|
|
||||||
#include "fmt/fmt.h"
|
#include "fmt/fmt.h"
|
||||||
|
|
||||||
#if !defined(SPDLOG_USE_STD_FORMAT) && \
|
#if defined(SPDLOG_WCHAR_FILENAMES) && !defined(SPDLOG_USE_STD_FORMAT)
|
||||||
FMT_VERSION >= 80000 // backward compatibility with fmt versions older than 8
|
|
||||||
#define SPDLOG_FMT_RUNTIME(format_string) fmt::runtime(format_string)
|
|
||||||
#if defined(SPDLOG_WCHAR_FILENAMES)
|
|
||||||
#include "fmt/xchar.h"
|
#include "fmt/xchar.h"
|
||||||
#endif
|
#endif
|
||||||
#else
|
|
||||||
#define SPDLOG_FMT_RUNTIME(format_string) format_string
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SPDLOG_FUNCTION
|
#ifndef SPDLOG_FUNCTION
|
||||||
#define SPDLOG_FUNCTION static_cast<const char *>(__FUNCTION__)
|
#define SPDLOG_FUNCTION static_cast<const char *>(__FUNCTION__)
|
||||||
|
@ -27,7 +27,7 @@ TEST_CASE("default_error_handler", "[errors]") {
|
|||||||
|
|
||||||
auto logger = spdlog::create<spdlog::sinks::basic_file_sink_mt>("test-error", filename, true);
|
auto logger = spdlog::create<spdlog::sinks::basic_file_sink_mt>("test-error", filename, true);
|
||||||
logger->set_pattern("%v");
|
logger->set_pattern("%v");
|
||||||
logger->info(SPDLOG_FMT_RUNTIME("Test message {} {}"), 1);
|
logger->info("Test message {} {}", 1);
|
||||||
logger->info("Test message {}", 2);
|
logger->info("Test message {}", 2);
|
||||||
logger->flush();
|
logger->flush();
|
||||||
using spdlog::details::os::default_eol;
|
using spdlog::details::os::default_eol;
|
||||||
@ -43,7 +43,7 @@ TEST_CASE("custom_error_handler", "[errors]") {
|
|||||||
logger->set_error_handler([=](const std::string &) { throw custom_ex(); });
|
logger->set_error_handler([=](const std::string &) { throw custom_ex(); });
|
||||||
logger->info("Good message #1");
|
logger->info("Good message #1");
|
||||||
|
|
||||||
REQUIRE_THROWS_AS(logger->info(SPDLOG_FMT_RUNTIME("Bad format msg {} {}"), "xxx"), custom_ex);
|
REQUIRE_THROWS_AS(logger->info("Bad format msg {} {}", "xxx"), custom_ex);
|
||||||
logger->info("Good message #2");
|
logger->info("Good message #2");
|
||||||
require_message_count(SIMPLE_LOG, 2);
|
require_message_count(SIMPLE_LOG, 2);
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ TEST_CASE("async_error_handler", "[errors]") {
|
|||||||
ofs << err_msg;
|
ofs << err_msg;
|
||||||
});
|
});
|
||||||
logger->info("Good message #1");
|
logger->info("Good message #1");
|
||||||
logger->info(SPDLOG_FMT_RUNTIME("Bad format msg {} {}"), "xxx");
|
logger->info("Bad format msg {} {}", "xxx");
|
||||||
logger->info("Good message #2");
|
logger->info("Good message #2");
|
||||||
spdlog::drop("logger"); // force logger to drain the queue and shutdown
|
spdlog::drop("logger"); // force logger to drain the queue and shutdown
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user