diff options
| author | Lioncash <mathew1800@gmail.com> | 2019-06-14 10:53:46 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2019-06-14 15:04:09 -0400 |
| commit | 5b92d5076a0be89945fa0fc722749dd5fbfcdf4c (patch) | |
| tree | b87080969dd47a01c3a7845d65ef2afdef90928d /Source/Core/Common/Logging/LogManager.cpp | |
| parent | 925afcae3b7b6ea8dde2cfd236288d924c42fa05 (diff) | |
Common: Use fmt where applicable
Begins the transition to using fmt for string formatting where
applicable. Given fmt supports formatting std::string instances out of
the box, we can remove now-unnecessary calls to .c_str() and .data().
Note that this change does not touch the actual logging subsystem aside
from converting the final StringFromFormat call in the process over to
fmt::format. Given our logging system is heavily used throughout the
entire codebase, and converting that over will be quite a large change
by itself, this will be tackled near the end of the conversion process.
Diffstat (limited to 'Source/Core/Common/Logging/LogManager.cpp')
| -rw-r--r-- | Source/Core/Common/Logging/LogManager.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Source/Core/Common/Logging/LogManager.cpp b/Source/Core/Common/Logging/LogManager.cpp index 4e946e8fd2..5a23cc7945 100644 --- a/Source/Core/Common/Logging/LogManager.cpp +++ b/Source/Core/Common/Logging/LogManager.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "Common/Logging/LogManager.h" + #include <algorithm> #include <cstdarg> #include <cstring> @@ -10,12 +12,13 @@ #include <ostream> #include <string> +#include <fmt/format.h> + #include "Common/CommonPaths.h" #include "Common/Config/Config.h" #include "Common/FileUtil.h" #include "Common/Logging/ConsoleListener.h" #include "Common/Logging/Log.h" -#include "Common/Logging/LogManager.h" #include "Common/StringUtil.h" #include "Common/Timer.h" @@ -207,9 +210,9 @@ void LogManager::LogWithFullPath(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE char temp[MAX_MSGLEN]; CharArrayFromFormatV(temp, MAX_MSGLEN, format, args); - std::string msg = - StringFromFormat("%s %s:%u %c[%s]: %s\n", Common::Timer::GetTimeFormatted().c_str(), file, - line, LogTypes::LOG_LEVEL_TO_CHAR[(int)level], GetShortName(type), temp); + const std::string msg = + fmt::format("{} {}:{} {}[{}]: {}\n", Common::Timer::GetTimeFormatted(), file, line, + LogTypes::LOG_LEVEL_TO_CHAR[(int)level], GetShortName(type), temp); for (auto listener_id : m_listener_ids) if (m_listeners[listener_id]) |
