From 43c95acd01968c33c8cc2a02c27e5d6d872022ef Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Wed, 4 Nov 2026 19:00:59 -0600 Subject: Common/Logging/LogManager: Combine GetTimestamp functionality into LogWithFullPath to eliminate one std::string construction. --- Source/Core/Common/Logging/LogManager.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'Source/Core/Common/Logging/LogManager.cpp') diff --git a/Source/Core/Common/Logging/LogManager.cpp b/Source/Core/Common/Logging/LogManager.cpp index 0bc51bfa5b..f35826793f 100644 --- a/Source/Core/Common/Logging/LogManager.cpp +++ b/Source/Core/Common/Logging/LogManager.cpp @@ -197,7 +197,8 @@ void LogManager::Log(LogLevel level, LogType type, const char* file, int line, LogWithFullPath(level, type, file + GetPathCutOffPoint(), line, message); } -std::string LogManager::GetTimestamp() +void LogManager::LogWithFullPath(LogLevel level, LogType type, const char* file, int line, + std::string_view message) { // NOTE: the Qt LogWidget hardcodes the expected length of the timestamp portion of the log line, // so ensure they stay in sync @@ -206,14 +207,9 @@ std::string LogManager::GetTimestamp() const auto now = std::chrono::system_clock::now(); const auto now_s = std::chrono::floor(now); const auto now_ms = std::chrono::floor(now); - return fmt::format("{:%M:%S}:{:03}", now_s, (now_ms - now_s).count()); -} -void LogManager::LogWithFullPath(LogLevel level, LogType type, const char* file, int line, - std::string_view message) -{ const std::string msg = - fmt::format("{} {}:{} {}[{}]: {}\n", GetTimestamp(), file, line, + fmt::format("{:%M:%S}:{:03} {}:{} {}[{}]: {}\n", now_s, (now_ms - now_s).count(), file, line, LOG_LEVEL_TO_CHAR[static_cast(level)], GetShortName(type), message); for (const auto listener_id : m_listener_ids) -- cgit v1.2.3