mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-28 17:19:34 +08:00
Added const qualifiers to logger.h
This commit is contained in:
@@ -57,7 +57,7 @@ SPDLOG_INLINE void logger::swap(spdlog::logger &other) SPDLOG_NOEXCEPT {
|
||||
std::swap(tracer_, other.tracer_);
|
||||
}
|
||||
|
||||
SPDLOG_INLINE void swap(logger &a, logger &b) { a.swap(b); }
|
||||
SPDLOG_INLINE void swap(logger &a, logger &b) noexcept { a.swap(b); }
|
||||
|
||||
SPDLOG_INLINE void logger::set_level(level::level_enum log_level) { level_.store(log_level); }
|
||||
|
||||
@@ -163,12 +163,12 @@ SPDLOG_INLINE void logger::dump_backtrace_() {
|
||||
}
|
||||
}
|
||||
|
||||
SPDLOG_INLINE bool logger::should_flush_(const details::log_msg &msg) {
|
||||
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);
|
||||
}
|
||||
|
||||
SPDLOG_INLINE void logger::err_handler_(const std::string &msg) {
|
||||
SPDLOG_INLINE void logger::err_handler_(const std::string &msg) const {
|
||||
if (custom_err_handler_) {
|
||||
custom_err_handler_(msg);
|
||||
} else {
|
||||
|
@@ -363,14 +363,14 @@ protected:
|
||||
virtual void sink_it_(const details::log_msg &msg);
|
||||
virtual void flush_();
|
||||
void dump_backtrace_();
|
||||
bool should_flush_(const details::log_msg &msg);
|
||||
bool should_flush_(const details::log_msg &msg) const;
|
||||
|
||||
// handle errors during logging.
|
||||
// default handler prints the error to stderr at max rate of 1 message/sec.
|
||||
void err_handler_(const std::string &msg);
|
||||
void err_handler_(const std::string &msg) const;
|
||||
};
|
||||
|
||||
void swap(logger &a, logger &b);
|
||||
void swap(logger &a, logger &b) noexcept;
|
||||
|
||||
} // namespace spdlog
|
||||
|
||||
|
Reference in New Issue
Block a user