Rename local variables to avoid shadowing member functions (#3516)

This commit is contained in:
Kağan Can Şit
2026-01-11 01:05:14 +03:00
committed by GitHub
parent 1774e70082
commit 309204d53c
2 changed files with 8 additions and 9 deletions

View File

@@ -164,8 +164,7 @@ SPDLOG_INLINE void logger::dump_backtrace_() {
} }
SPDLOG_INLINE bool logger::should_flush_(const details::log_msg &msg) const { SPDLOG_INLINE bool logger::should_flush_(const details::log_msg &msg) const {
auto flush_level = flush_level_.load(std::memory_order_relaxed); return (msg.level >= flush_level()) && (msg.level != level::off);
return (msg.level >= flush_level) && (msg.level != level::off);
} }
SPDLOG_INLINE void logger::err_handler_(const std::string &msg) const { SPDLOG_INLINE void logger::err_handler_(const std::string &msg) const {

View File

@@ -88,8 +88,8 @@ public:
} }
auto now = log_clock::now(); auto now = log_clock::now();
auto filename = FileNameCalc::calc_filename(base_filename_, now_tm(now)); const auto new_filename = FileNameCalc::calc_filename(base_filename_, now_tm(now));
file_helper_.open(filename, truncate_); file_helper_.open(new_filename, truncate_);
rotation_tp_ = next_rotation_tp_(); rotation_tp_ = next_rotation_tp_();
if (max_files_ > 0) { if (max_files_ > 0) {
@@ -107,8 +107,8 @@ protected:
auto time = msg.time; auto time = msg.time;
bool should_rotate = time >= rotation_tp_; bool should_rotate = time >= rotation_tp_;
if (should_rotate) { if (should_rotate) {
auto filename = FileNameCalc::calc_filename(base_filename_, now_tm(time)); const auto new_filename = FileNameCalc::calc_filename(base_filename_, now_tm(time));
file_helper_.open(filename, truncate_); file_helper_.open(new_filename, truncate_);
rotation_tp_ = next_rotation_tp_(); rotation_tp_ = next_rotation_tp_();
} }
memory_buf_t formatted; memory_buf_t formatted;
@@ -131,11 +131,11 @@ private:
std::vector<filename_t> filenames; std::vector<filename_t> filenames;
auto now = log_clock::now(); auto now = log_clock::now();
while (filenames.size() < max_files_) { while (filenames.size() < max_files_) {
auto filename = FileNameCalc::calc_filename(base_filename_, now_tm(now)); const auto new_filename = FileNameCalc::calc_filename(base_filename_, now_tm(now));
if (!path_exists(filename)) { if (!path_exists(new_filename)) {
break; break;
} }
filenames.emplace_back(filename); filenames.emplace_back(new_filename);
now -= std::chrono::hours(24); now -= std::chrono::hours(24);
} }
for (auto iter = filenames.rbegin(); iter != filenames.rend(); ++iter) { for (auto iter = filenames.rbegin(); iter != filenames.rend(); ++iter) {