V2.x no reg (#3285)

Removed registry
This commit is contained in:
Gabi Melman
2024-12-06 19:21:42 +02:00
committed by GitHub
parent ed6919bf8e
commit 166843ff3a
52 changed files with 308 additions and 1336 deletions

View File

@@ -4,8 +4,8 @@
*/
#include "includes.h"
#include "spdlog/sinks/daily_file_sink.h"
#include "spdlog/sinks/rotating_file_sink.h"
#include "spdlog/sinks/hourly_file_sink.h"
#include "spdlog/sinks/rotating_file_sink.h"
using filename_memory_buf_t = spdlog::memory_buf_t;
@@ -48,8 +48,7 @@ TEST_CASE("daily_logger with custom calculator", "[daily_logger]") {
std::tm tm = spdlog::details::os::localtime();
auto w = spdlog::fmt_lib::format(SPDLOG_FILENAME_T("{}{:04d}{:02d}{:02d}"), basename.native(), tm.tm_year + 1900,
tm.tm_mon + 1,
tm.tm_mday);
tm.tm_mon + 1, tm.tm_mday);
auto logger = spdlog::create<sink_type>("logger", basename, 0, 0);
for (int i = 0; i < 10; ++i) {
@@ -82,26 +81,24 @@ TEST_CASE("rotating_file_sink::calc_filename3", "[rotating_file_sink]") {
// regex supported only from gcc 4.9 and above
#if defined(_MSC_VER) || !(__GNUC__ <= 4 && __GNUC_MINOR__ < 9)
#include <regex>
#include <regex>
TEST_CASE("daily_file_sink::daily_filename_calculator", "[daily_file_sink]") {
// daily_YYYY-MM-DD_hh-mm.txt
auto filename =
spdlog::sinks::daily_filename_calculator::calc_filename(SPDLOG_FILENAME_T("daily.txt"),
spdlog::details::os::localtime());
auto filename =
spdlog::sinks::daily_filename_calculator::calc_filename(SPDLOG_FILENAME_T("daily.txt"), spdlog::details::os::localtime());
// date regex based on https://www.regular-expressions.info/dates.html
std::basic_regex<spdlog::filename_t::value_type> re(
SPDLOG_FILENAME_T(R"(^daily_(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])\.txt$)"));
std::match_results<spdlog::filename_t::string_type::const_iterator> match;
REQUIRE(std::regex_match(filename.native(), match, re));
}
std::basic_regex<spdlog::filename_t::value_type> re(
SPDLOG_FILENAME_T(R"(^daily_(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])\.txt$)"));
std::match_results<spdlog::filename_t::string_type::const_iterator> match;
REQUIRE(std::regex_match(filename.native(), match, re));
}
TEST_CASE("hourly_file_sink::hourly_filename_calculator", "[hrouly_file_sink]") {
// daily_YYYY-MM-DD_hh-mm.txt
auto filename =
spdlog::sinks::hourly_filename_calculator::calc_filename(SPDLOG_FILENAME_T("hourly.txt"), spdlog::details::os::localtime());
auto filename = spdlog::sinks::hourly_filename_calculator::calc_filename(SPDLOG_FILENAME_T("hourly.txt"),
spdlog::details::os::localtime());
// date regex based on https://www.regular-expressions.info/dates.html
std::basic_regex<spdlog::filename_t::value_type> re(
SPDLOG_FILENAME_T(R"(^hourly_(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])_\d\d\.txt$)"));