SPDLOG_USE_STD_FORMAT 如果设置为ON,则使用std::format而非fmt库。 CMAKE_CXX_STANDARD 设置C++标准版本。如果SPDLOG_USE_STD_FORMAT为ON,使用C++20;否则,默认为C++11。 MSVC 针对Microsoft Visual C++特有的编译器标志,比如/Zc:__cplusplus /MP。 CMAKE_CXX_EXTENSIONS 设置是否使用编译器特定扩展。在CYGWIN或M...
#ifdef SPDLOG_USE_STD_FORMAT fmt_lib::vformat_to(std::back_inserter(buf), fmt, fmt_lib::make_format_args(args...)); // 字符串格式化处理(使用std::fmt)#elsefmt::vformat_to(fmt::appender(buf), fmt, fmt::make_format_args(args...)); // 字符串格式化处理(使用第三方fmt库)#endifde...
{memory_buf_tbuf;// 二进制缓存#ifdefSPDLOG_USE_STD_FORMATfmt_lib::vformat_to(std::back_inserter(buf), fmt, fmt_lib::make_format_args(std::forward<Args>(args)...));#else// seems that fmt::detail::vformat_to(buf, ...) is ~20ns faster than fmt::vformat_to(std::back_inserter...
Set C++20 in CMake when SPDLOG_USE_STD_FORMAT option is turned on #2402. Thanks @cookcocck Fix mingw test #2415. Thanks @neheb Support for any std::chrono::duration type in flush_every(..) #2439. Thanks @LucasChollet Fix implicit casting of level_enum #2443. Thanks @ibmibmibm ...
auto s = fmt::format(std::locale("en_US.UTF-8"), "{:L}", 1234567890); // s == "1,234,567,890" 格式化类型: 格式化类型: 示例: fmt::format("{:*^30}", "centered"); // use '*' as a fill char // Result: "***centered***" fmt::format("{:#04x}...
message(FATAL_ERROR "SPDLOG_USE_STD_FORMAT and SPDLOG_FMT_EXTERNAL are mutually exclusive") endif() # misc tweakme options if(WIN32) option(SPDLOG_WCHAR_SUPPORT "Support wchar api" OFF) option(SPDLOG_WCHAR_FILENAMES "Support wchar filenames" OFF) ...
());// use default pattern is not givenexplicit pattern_formatter(pattern_time_type time_type = pattern_time_type::local, std::string eol = spdlog::details::os::default_eol);pattern_formatter(const pattern_formatter &other) = delete;pattern_formatter &operator=(const pattern_formatter &other...
auto firstLogger = std::make_shared<spdlog::logger>("first", sharedFileSink); auto secondLogger = std::make_unique<spdlog::logger>("second", sharedFileSink); 1. 2. 3. 格式 日志格式可以使用 (1) set_pattern(pattern_string) (2) 实现formatter的接口,然后调用set_formatter(std::make_unique...
auto s=fmt::format(std::locale("en_US.UTF-8"),"{:L}",1234567890);// s == "1,234,567,890" 格式化类型: 示例: 代码语言:javascript 复制 fmt::format("{:*^30}","centered");// use '*' as a fill char// Result: "***centered***"fmt::format("{:#04x}",0);// Result: ...
#include "spdlog/pattern_formatter.h" class my_formatter_flag : public spdlog::custom_flag_formatter { public: void format(const spdlog::details::log_msg &, const std::tm &, spdlog::memory_buf_t &dest) override { std::string some_txt = "custom-flag"; dest.append(some_txt.data(),...