summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2026-11-04 19:00:59 -0600
committerJordan Woyak <jordan.woyak@gmail.com>2026-11-08 13:08:09 -0600
commit43c95acd01968c33c8cc2a02c27e5d6d872022ef (patch)
tree74c097decc1f65d8c39cbdf78781b75afda21b25 /Source/Core/Common
parent055767399abab0eff6f55acbf480e54fcd83f6bd (diff)
Common/Logging/LogManager: Combine GetTimestamp functionality into LogWithFullPath to eliminate one std::string construction.
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/Logging/LogManager.cpp10
-rw-r--r--Source/Core/Common/Logging/LogManager.h1
2 files changed, 3 insertions, 8 deletions
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<std::chrono::seconds>(now);
const auto now_ms = std::chrono::floor<std::chrono::milliseconds>(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<int>(level)], GetShortName(type), message);
for (const auto listener_id : m_listener_ids)
diff --git a/Source/Core/Common/Logging/LogManager.h b/Source/Core/Common/Logging/LogManager.h
index 060488a98f..bd388e6d74 100644
--- a/Source/Core/Common/Logging/LogManager.h
+++ b/Source/Core/Common/Logging/LogManager.h
@@ -87,7 +87,6 @@ public:
private:
LogManager();
- static std::string GetTimestamp();
void SetEffectiveLogLevel();
std::atomic<LogLevel> m_effective_level;