mirror of
https://github.com/gabime/spdlog.git
synced 2026-04-10 11:34:29 +08:00
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...
}
```
12 lines
417 B
C
12 lines
417 B
C
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
|
|
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
|
|
|
#pragma once
|
|
|
|
#define SPDLOG_VER_MAJOR 1
|
|
#define SPDLOG_VER_MINOR 12
|
|
#define SPDLOG_VER_PATCH 0
|
|
|
|
#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)
|