aboutsummaryrefslogtreecommitdiff
path: root/src/common/logging/backend.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-08-13 21:44:53 -0400
committerLioncash <mathew1800@gmail.com>2018-08-13 21:44:55 -0400
commitbc7bfd96f0af67f7944357b260cb954548c415ba (patch)
tree71559e02e6adcddb19af6b584cc5bf7374a50add /src/common/logging/backend.cpp
parent309564abe3c6bf9f138e8b764b63d2ac4f8e9240 (diff)
logging/backend: Use const reference to refer to log filter
The filter is returned via const reference, so this was making a pointless copy of the entire filter every time a message was being pushed into the logger instance.
Diffstat (limited to 'src/common/logging/backend.cpp')
-rw-r--r--src/common/logging/backend.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index e80784c3cd..1323f8d0f7 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -302,13 +302,14 @@ Backend* GetBackend(std::string_view backend_name) {
void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename,
unsigned int line_num, const char* function, const char* format,
const fmt::format_args& args) {
- auto filter = Impl::Instance().GetGlobalFilter();
+ auto& instance = Impl::Instance();
+ const auto& filter = instance.GetGlobalFilter();
if (!filter.CheckMessage(log_class, log_level))
return;
Entry entry =
CreateEntry(log_class, log_level, filename, line_num, function, fmt::vformat(format, args));
- Impl::Instance().PushEntry(std::move(entry));
+ instance.PushEntry(std::move(entry));
}
} // namespace Log