From a76de8669f759f69e766828cb5e29ccbdb74ce92 Mon Sep 17 00:00:00 2001 From: Matt Haynie Date: Wed, 6 Jan 2021 16:08:59 -0800 Subject: [PATCH] Hooked up the discord log function. --- tf2_bot_detector/DiscordRichPresence.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tf2_bot_detector/DiscordRichPresence.cpp b/tf2_bot_detector/DiscordRichPresence.cpp index ad406485..ffa85e56 100644 --- a/tf2_bot_detector/DiscordRichPresence.cpp +++ b/tf2_bot_detector/DiscordRichPresence.cpp @@ -105,6 +105,11 @@ static auto DiscordDebugLog(const mh::source_location& location, DebugLog(DISCORD_LOG_COLOR, location, "DRP: {}", mh::format(fmtStr, args...)); } +static void DiscordLogHookFunc(discord::LogLevel level, const char* logMsg) +{ + DebugLog(DISCORD_LOG_COLOR, logMsg); +} + namespace { enum class ConnectionState @@ -890,6 +895,8 @@ void DiscordState::Update() { m_Core.reset(core); + core->SetLogHook(discord::LogLevel::Debug, &DiscordLogHookFunc); + if (auto result = m_Core->ActivityManager().RegisterSteam(440); result != discord::Result::Ok) LogError("Failed to register discord integration as steam appid 440: {}", mh::enum_fmt(result)); }