more well-defined definition of list instantiation using a pre-defined type

pull/2687/head
Bailey Chittle 3 years ago
parent feca242449
commit 10d144f3e9

@ -404,5 +404,5 @@ void attribute_example() {
std::string logfmt_pattern = "time=%Y-%m-%dT%H:%M:%S.%f%z, name=%n, level=%^%l%$, process=%P, thread=%t, message=\"%v\", ";
logfmt_logger->set_pattern(logfmt_pattern);
logfmt_logger->log(spdlog::level::info, "logfmt structured logging", {{"key\n1", "value\n1"}, {"key\r\n2", "value\r\n2"}});
logfmt_logger->log(spdlog::level::info, "logfmt structured logging", spdlog::attribute_list{{"key\n1", "value\n1"}, {"key\r\n2", "value\r\n2"}});
}

@ -2,7 +2,7 @@
#include <string>
#include <string_view>
#include <concepts>
#include <vector>
#include "attr_composer.h"
namespace spdlog {
@ -42,4 +42,7 @@ public:
};
} // namespace details
using attribute_list = std::vector<details::attr>;
} // namespace spdlog

@ -29,7 +29,7 @@ struct SPDLOG_API log_msg
source_loc source;
string_view_t payload;
std::vector<attr> attributes;
attribute_list attributes;
};
} // namespace details
} // namespace spdlog

@ -85,7 +85,7 @@ public:
void swap(spdlog::logger &other) SPDLOG_NOEXCEPT;
template <typename T>
void log(level::level_enum lvl, const T &msg, std::initializer_list<details::attr> attrs)
void log(level::level_enum lvl, const T &msg, attribute_list attrs)
{
log(source_loc{}, lvl, msg, attrs);
}
@ -128,7 +128,7 @@ public:
log_it_(log_msg, log_enabled, traceback_enabled);
}
void log(source_loc loc, level::level_enum lvl, string_view_t msg, std::initializer_list<details::attr> attrs)
void log(source_loc loc, level::level_enum lvl, string_view_t msg, attribute_list attrs)
{
bool log_enabled = should_log(lvl);
bool traceback_enabled = tracer_.enabled();

Loading…
Cancel
Save