in src/cpp/RiderLink/Source/RiderLogging/Private/RiderLogging.cpp [94:133]
void FRiderLoggingModule::StartupModule()
{
UE_LOG(FLogRiderLoggingModule, Verbose, TEXT("STARTUP START"));
static const auto START_TIME = FDateTime::UtcNow().ToUnixTimestamp();
static const auto GetTimeNow = [](double Time) -> rd::DateTime
{
return rd::DateTime(START_TIME + static_cast<int64>(Time));
};
ModuleLifetimeDef = IRiderLinkModule::Get().CreateNestedLifetimeDefinition();
LoggingScheduler = MakeUnique<rd::SingleThreadScheduler>(ModuleLifetimeDef.lifetime, "LoggingScheduler");
ModuleLifetimeDef.lifetime->bracket(
[this]()
{
OutputDevice.Setup([this](const TCHAR* msg, ELogVerbosity::Type Type, const FName& Name, TOptional<double> Time)
{
if (Type > ELogVerbosity::All) return;
rd::optional<rd::DateTime> DateTime;
if (Time)
{
DateTime = GetTimeNow(Time.GetValue());
}
const FString PlainName = Name.GetPlainNameString();
const JetBrains::EditorPlugin::LogMessageInfo MessageInfo{Type, PlainName, DateTime};
LoggingScheduler->queue([Msg = FString(msg), MessageInfo]() mutable
{
LoggingExtensionImpl::ScheduledSendMessage(&Msg, MessageInfo);
});
});
},
[this]()
{
OutputDevice.TearDown();
});
UE_LOG(FLogRiderLoggingModule, Verbose, TEXT("STARTUP FINISH"));
}