VideoCommon/FrameDump: printf-format messages before logging them

This commit is contained in:
Pokechu22 2022-05-19 11:55:27 -07:00
parent 35cb5c8f75
commit 0637c17b59
1 changed files with 13 additions and 1 deletions

View File

@ -28,7 +28,9 @@ extern "C" {
#include "Common/ChunkFile.h" #include "Common/ChunkFile.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/Logging/LogManager.h"
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Common/StringUtil.h"
#include "Core/Config/MainSettings.h" #include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
@ -95,7 +97,17 @@ void InitAVCodec()
// keep libav debug messages visible in release build of dolphin // keep libav debug messages visible in release build of dolphin
log_level = Common::Log::LogLevel::LINFO; log_level = Common::Log::LogLevel::LINFO;
GENERIC_LOG_V(Common::Log::LogType::FRAMEDUMP, log_level, fmt, vl); // Don't perform this formatting if the log level is disabled
auto* log_manager = Common::Log::LogManager::GetInstance();
if (log_manager != nullptr &&
log_manager->IsEnabled(Common::Log::LogType::FRAMEDUMP, log_level))
{
constexpr size_t MAX_MSGLEN = 1024;
char message[MAX_MSGLEN];
CharArrayFromFormatV(message, MAX_MSGLEN, fmt, vl);
GENERIC_LOG_FMT(Common::Log::LogType::FRAMEDUMP, log_level, "{}", message);
}
}); });
// TODO: We never call avformat_network_deinit. // TODO: We never call avformat_network_deinit.