|
|
|
@ -191,14 +191,20 @@ void binary_example()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Log a vector of numbers
|
|
|
|
|
|
|
|
|
|
#include "spdlog/fmt/bundled/ranges.h"
|
|
|
|
|
#ifndef SPDLOG_USE_STD_FORMAT
|
|
|
|
|
# include "spdlog/fmt/bundled/ranges.h"
|
|
|
|
|
void vector_example()
|
|
|
|
|
{
|
|
|
|
|
std::vector<int> vec = {1, 2, 3};
|
|
|
|
|
spdlog::info("Vector example: {}", vec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
void vector_example() {}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// ! DSPDLOG_USE_STD_FORMAT
|
|
|
|
|
|
|
|
|
|
// Compile time log levels.
|
|
|
|
|
// define SPDLOG_ACTIVE_LEVEL to required level (e.g. SPDLOG_LEVEL_TRACE)
|
|
|
|
|
void trace_example()
|
|
|
|
@ -252,10 +258,14 @@ void multi_sink_example()
|
|
|
|
|
struct my_type
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
template<typename OStream>
|
|
|
|
|
friend OStream &operator<<(OStream &os, const my_type &c)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template<>
|
|
|
|
|
struct std::formatter<my_type> : std::formatter<std::string>
|
|
|
|
|
{
|
|
|
|
|
auto format(my_type my, format_context &ctx)
|
|
|
|
|
{
|
|
|
|
|
return os << "[my_type i=" << c.i << "]";
|
|
|
|
|
return formatter<string>::format(std::format("[my_type i={}]", my.i), ctx);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -354,4 +364,3 @@ void replace_default_logger_example()
|
|
|
|
|
|
|
|
|
|
spdlog::set_default_logger(old_logger);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|