You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb none #lockdown Nick.Penwarden #ROBOMERGE-OWNER: robert.manuszewski #ROBOMERGE-AUTHOR: jeanmichel.dignard #ROBOMERGE-SOURCE: CL 4784913 in //UE4/Main/... #ROBOMERGE-BOT: CORE (Main -> Dev-Core) [CL 4793830 by Robert Manuszewski in Dev-Core branch]
68 lines
1.4 KiB
C++
68 lines
1.4 KiB
C++
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "WebRTCLogging.h"
|
|
#include "StringUtils.h"
|
|
#include "FileLogOutput.h"
|
|
#include "TimeUtils.h"
|
|
|
|
extern bool PARAM_DbgWindow_WebRTC;
|
|
|
|
/**
|
|
* Receives logging from WebRTC internals, and writes it to a log file
|
|
* and VS's Output window
|
|
*/
|
|
class FWebRTCLogger : public rtc::LogSink
|
|
{
|
|
public:
|
|
FWebRTCLogger()
|
|
: FileLog(nullptr, "-WebRTC.log")
|
|
{
|
|
// Disable WebRTC's internal calls to VS's OutputDebugString, because we are calling here,
|
|
// so we can add timestamps.
|
|
rtc::LogMessage::LogToDebug(rtc::LS_NONE);
|
|
}
|
|
|
|
~FWebRTCLogger()
|
|
{
|
|
}
|
|
|
|
private:
|
|
void OnLogMessage(const std::string& message) override
|
|
{
|
|
FDateTime DateTime = PARAM_LocalTime ? Now() : UtcNow();
|
|
const char* Msg = FormatString(
|
|
"[%s]: WEBRTC: %s",
|
|
DateTime.ToString(),
|
|
message.c_str());
|
|
|
|
if (PARAM_DbgWindow_WebRTC)
|
|
{
|
|
OutputDebugStringA(Msg);
|
|
}
|
|
|
|
FileLog.Write(Msg);
|
|
}
|
|
|
|
FFileLogOutput FileLog;
|
|
};
|
|
|
|
namespace
|
|
{
|
|
std::unique_ptr<FWebRTCLogger> WebRTCLogger;
|
|
}
|
|
|
|
void InitializeWebRTCLogging(rtc::LoggingSeverity Verbosity)
|
|
{
|
|
WebRTCLogger = std::make_unique<FWebRTCLogger>();
|
|
rtc::LogMessage::AddLogToStream(WebRTCLogger.get(), Verbosity);
|
|
rtc::LogMessage::SetLogToStderr(false);
|
|
}
|
|
|
|
void StopWebRTCLogging()
|
|
{
|
|
EG_LOG(LogDefault, Log, "Stopping WebRTC logging");
|
|
rtc::LogMessage::RemoveLogToStream(WebRTCLogger.get());
|
|
WebRTCLogger.reset();
|
|
}
|
|
|