mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-25 18:11:33 +08:00
Micro-optimize level checking by inlining
This commit is contained in:
parent
3ee4f2810d
commit
bf40855825
@ -64,16 +64,6 @@ SPDLOG_INLINE void swap(logger &a, logger &b)
|
|||||||
a.swap(b);
|
a.swap(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
SPDLOG_INLINE bool logger::should_log(level::level_enum msg_level) const
|
|
||||||
{
|
|
||||||
return msg_level >= level_.load(std::memory_order_relaxed);
|
|
||||||
}
|
|
||||||
|
|
||||||
SPDLOG_INLINE bool logger::should_backtrace() const
|
|
||||||
{
|
|
||||||
return tracer_.enabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
SPDLOG_INLINE void logger::set_level(level::level_enum log_level)
|
SPDLOG_INLINE void logger::set_level(level::level_enum log_level)
|
||||||
{
|
{
|
||||||
level_.store(log_level);
|
level_.store(log_level);
|
||||||
|
@ -299,10 +299,16 @@ public:
|
|||||||
#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
|
#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
|
||||||
|
|
||||||
// return true logging is enabled for the given level.
|
// return true logging is enabled for the given level.
|
||||||
bool should_log(level::level_enum msg_level) const;
|
bool should_log(level::level_enum msg_level) const
|
||||||
|
{
|
||||||
|
return msg_level >= level_.load(std::memory_order_relaxed);
|
||||||
|
}
|
||||||
|
|
||||||
// return true if backtrace logging is enabled.
|
// return true if backtrace logging is enabled.
|
||||||
bool should_backtrace() const;
|
bool should_backtrace() const
|
||||||
|
{
|
||||||
|
return tracer_.enabled();
|
||||||
|
}
|
||||||
|
|
||||||
void set_level(level::level_enum log_level);
|
void set_level(level::level_enum log_level);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user