mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-28 17:19:34 +08:00
Compare commits
5 Commits
gabime/v1.
...
fix-3360
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8a0a3fa7ab | ||
![]() |
3335c380a0 | ||
![]() |
f355b3d58f | ||
![]() |
ac432c3602 | ||
![]() |
3c23c27d2d |
@@ -36,6 +36,7 @@ see example [CMakeLists.txt](https://github.com/gabime/spdlog/blob/v1.x/example/
|
||||
* Gentoo: `emerge dev-libs/spdlog`
|
||||
* Arch Linux: `pacman -S spdlog`
|
||||
* openSUSE: `sudo zypper in spdlog-devel`
|
||||
* ALT Linux: `apt-get install libspdlog-devel`
|
||||
* vcpkg: `vcpkg install spdlog`
|
||||
* conan: `conan install --requires=spdlog/[*]`
|
||||
* conda: `conda install -c conda-forge spdlog`
|
||||
|
@@ -27,5 +27,4 @@
|
||||
#else // SPDLOG_FMT_EXTERNAL is defined - use external fmtlib
|
||||
#include <fmt/core.h>
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/xchar.h>
|
||||
#endif
|
||||
|
@@ -70,6 +70,9 @@ public:
|
||||
pad_it(remaining_pad_);
|
||||
} else if (padinfo_.truncate_) {
|
||||
long new_size = static_cast<long>(dest_.size()) + remaining_pad_;
|
||||
if (new_size < 0) {
|
||||
new_size = 0;
|
||||
}
|
||||
dest_.resize(static_cast<size_t>(new_size));
|
||||
}
|
||||
}
|
||||
@@ -264,7 +267,7 @@ public:
|
||||
: flag_formatter(padinfo) {}
|
||||
|
||||
void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override {
|
||||
const size_t field_size = 10;
|
||||
const size_t field_size = 8;
|
||||
ScopedPadder p(field_size, padinfo_, dest);
|
||||
|
||||
fmt_helper::pad2(tm_time.tm_mon + 1, dest);
|
||||
@@ -926,9 +929,8 @@ private:
|
||||
memory_buf_t cached_datetime_;
|
||||
|
||||
#ifndef SPDLOG_NO_TLS
|
||||
mdc_formatter<null_scoped_padder> mdc_formatter_{padding_info{}};
|
||||
mdc_formatter<null_scoped_padder> mdc_formatter_{padding_info {}};
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace details
|
||||
|
@@ -46,12 +46,10 @@ TEST_CASE("daily_logger with dateonly calculator", "[daily_logger]") {
|
||||
|
||||
struct custom_daily_file_name_calculator {
|
||||
static spdlog::filename_t calc_filename(const spdlog::filename_t &basename, const tm &now_tm) {
|
||||
filename_memory_buf_t w;
|
||||
spdlog::fmt_lib::format_to(std::back_inserter(w), SPDLOG_FILENAME_T("{}{:04d}{:02d}{:02d}"),
|
||||
|
||||
return spdlog::fmt_lib::format(SPDLOG_FILENAME_T("{}{:04d}{:02d}{:02d}"),
|
||||
basename, now_tm.tm_year + 1900, now_tm.tm_mon + 1,
|
||||
now_tm.tm_mday);
|
||||
|
||||
return SPDLOG_BUF_TO_STRING(w);
|
||||
now_tm.tm_mday);
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user