mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-24 17:41:34 +08:00
Add SPDLOG_TO_VERSION to compare spdlog version (#2853)
You can use SPDLOG_VERSION to select the latest spdlog features where available while falling back to older implementations otherwise. Using SPDLOG_TO_VERSION() for the value to compare with is recommended. for Example: ```c++ void sink_it_(const details::log_msg &msg) override { #if SPDLOG_VERSION < SPDLOG_TO_VERSION(1,4,0) fmt::memory_buffer formatted; #else memory_buf_t formatted; #endif sinks::base_sink<Mutex>::formatter_->format(msg, formatted); // bala bala... } ```
This commit is contained in:
parent
2312489bdc
commit
cedfeeb95f
@ -7,4 +7,5 @@
|
||||
#define SPDLOG_VER_MINOR 12
|
||||
#define SPDLOG_VER_PATCH 0
|
||||
|
||||
#define SPDLOG_VERSION (SPDLOG_VER_MAJOR * 10000 + SPDLOG_VER_MINOR * 100 + SPDLOG_VER_PATCH)
|
||||
#define SPDLOG_TO_VERSION(major, minor, patch) (major * 10000 + minor * 100 + patch)
|
||||
#define SPDLOG_VERSION SPDLOG_TO_VERSION(SPDLOG_VER_MAJOR, SPDLOG_VER_MINOR, SPDLOG_VER_PATCH)
|
||||
|
Loading…
Reference in New Issue
Block a user