mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-08 20:58:41 +00:00
logging: Format message after filter check (#3808)
This commit is contained in:
@@ -182,7 +182,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PushEntry(Class log_class, Level log_level, const char* filename, unsigned int line_num,
|
void PushEntry(Class log_class, Level log_level, const char* filename, unsigned int line_num,
|
||||||
const char* function, std::string message) {
|
const char* function, const char* format, const fmt::format_args& args) {
|
||||||
|
if (!filter.CheckMessage(log_class, log_level) || !Config::getLoggingEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto message = fmt::vformat(format, args);
|
||||||
|
|
||||||
// Propagate important log messages to the profiler
|
// Propagate important log messages to the profiler
|
||||||
if (IsProfilerConnected()) {
|
if (IsProfilerConnected()) {
|
||||||
const auto& msg_str = fmt::format("[{}] {}", GetLogClassName(log_class), message);
|
const auto& msg_str = fmt::format("[{}] {}", GetLogClassName(log_class), message);
|
||||||
@@ -201,10 +207,6 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filter.CheckMessage(log_class, log_level) || !Config::getLoggingEnabled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
using std::chrono::duration_cast;
|
using std::chrono::duration_cast;
|
||||||
using std::chrono::microseconds;
|
using std::chrono::microseconds;
|
||||||
using std::chrono::steady_clock;
|
using std::chrono::steady_clock;
|
||||||
@@ -324,8 +326,8 @@ void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename,
|
|||||||
unsigned int line_num, const char* function, const char* format,
|
unsigned int line_num, const char* function, const char* format,
|
||||||
const fmt::format_args& args) {
|
const fmt::format_args& args) {
|
||||||
if (!initialization_in_progress_suppress_logging) [[likely]] {
|
if (!initialization_in_progress_suppress_logging) [[likely]] {
|
||||||
Impl::Instance().PushEntry(log_class, log_level, filename, line_num, function,
|
Impl::Instance().PushEntry(log_class, log_level, filename, line_num, function, format,
|
||||||
fmt::vformat(format, args));
|
args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace Common::Log
|
} // namespace Common::Log
|
||||||
|
|||||||
Reference in New Issue
Block a user