summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorMai M <mathew1800@gmail.com>2022-04-08 20:47:57 -0400
committerGitHub <noreply@github.com>2022-04-08 20:47:57 -0400
commitdcf27b91bafd3ae2f69413ab3faa04b8e295fe3e (patch)
treef0fe2d80fb01f76b2b5b26e2ba36af0b78cd866f /Source/Core
parent120208ae03d7dd464e05c90dfa14959a591af5ce (diff)
parentdf214af8a1a3b19f1c06041853daa59dcc927780 (diff)
Merge pull request #10572 from AdmiralCurtiss/ffmpeg-log-va-list
VideoCommon/FrameDump: Fix log messages with arguments.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/Logging/Log.h10
-rw-r--r--Source/Core/Common/Logging/LogManager.cpp16
-rw-r--r--Source/Core/VideoCommon/FrameDump.cpp2
3 files changed, 27 insertions, 1 deletions
diff --git a/Source/Core/Common/Logging/Log.h b/Source/Core/Common/Logging/Log.h
index a6eedff39b..092a9b4dc6 100644
--- a/Source/Core/Common/Logging/Log.h
+++ b/Source/Core/Common/Logging/Log.h
@@ -103,6 +103,9 @@ void GenericLog(LogLevel level, LogType type, const char* file, int line, const
__attribute__((format(printf, 5, 6)))
#endif
;
+
+void GenericLogV(LogLevel level, LogType type, const char* file, int line, const char* fmt,
+ va_list args);
} // namespace Common::Log
// Let the compiler optimize this out
@@ -139,6 +142,13 @@ void GenericLog(LogLevel level, LogType type, const char* file, int line, const
GENERIC_LOG(Common::Log::LogType::t, Common::Log::LogLevel::LDEBUG, __VA_ARGS__); \
} while (0)
+#define GENERIC_LOG_V(t, v, fmt, args) \
+ do \
+ { \
+ if (v <= Common::Log::MAX_LOGLEVEL) \
+ Common::Log::GenericLogV(v, t, __FILE__, __LINE__, fmt, args); \
+ } while (0)
+
// fmtlib capable API
#define GENERIC_LOG_FMT(t, v, format, ...) \
diff --git a/Source/Core/Common/Logging/LogManager.cpp b/Source/Core/Common/Logging/LogManager.cpp
index a7b0b010ea..bed3a183e4 100644
--- a/Source/Core/Common/Logging/LogManager.cpp
+++ b/Source/Core/Common/Logging/LogManager.cpp
@@ -80,6 +80,22 @@ void GenericLog(LogLevel level, LogType type, const char* file, int line, const
instance->Log(level, type, file, line, message);
}
+void GenericLogV(LogLevel level, LogType type, const char* file, int line, const char* fmt,
+ va_list args)
+{
+ auto* instance = LogManager::GetInstance();
+ if (instance == nullptr)
+ return;
+
+ if (!instance->IsEnabled(type, level))
+ return;
+
+ char message[MAX_MSGLEN];
+ CharArrayFromFormatV(message, MAX_MSGLEN, fmt, args);
+
+ instance->Log(level, type, file, line, message);
+}
+
void GenericLogFmtImpl(LogLevel level, LogType type, const char* file, int line,
fmt::string_view format, const fmt::format_args& args)
{
diff --git a/Source/Core/VideoCommon/FrameDump.cpp b/Source/Core/VideoCommon/FrameDump.cpp
index 7054ba11af..9cbc741b51 100644
--- a/Source/Core/VideoCommon/FrameDump.cpp
+++ b/Source/Core/VideoCommon/FrameDump.cpp
@@ -94,7 +94,7 @@ void InitAVCodec()
// keep libav debug messages visible in release build of dolphin
log_level = Common::Log::LogLevel::LINFO;
- GENERIC_LOG(Common::Log::LogType::FRAMEDUMP, log_level, fmt, vl);
+ GENERIC_LOG_V(Common::Log::LogType::FRAMEDUMP, log_level, fmt, vl);
});
// TODO: We never call avformat_network_deinit.