| #include "RiderOutputDevice.hpp" |
|
|
| #include "CoreGlobals.h" |
| #include "Misc/ScopeLock.h" |
| #include "Misc/OutputDeviceRedirector.h" |
|
|
| void FRiderOutputDevice::Serialize(const TCHAR* V, ELogVerbosity::Type Verbosity, const FName& Category) |
| { |
| Serialize(V, Verbosity, Category, {}); |
| } |
|
|
| void FRiderOutputDevice::Serialize(const TCHAR* V, ELogVerbosity::Type Verbosity, const FName& Category, |
| const double Time) |
| { |
| FScopeLock Lock{&CriticalSection}; |
| |
| onSerializeMessage.ExecuteIfBound(V, Verbosity, Category, {Time}); |
| } |
|
|
| FRiderOutputDevice::~FRiderOutputDevice() |
| { |
| |
| |
| |
| if (GLog != nullptr) |
| { |
| GLog->RemoveOutputDevice(this); |
| } |
| } |
|
|
| void FRiderOutputDevice::Setup(TFunction<FOnSerializeMessage::TFuncType> Callback) |
| { |
| FScopeLock Lock{&CriticalSection}; |
|
|
| if(onSerializeMessage.IsBound()) return; |
| |
| onSerializeMessage.BindLambda(Callback); |
| GLog->AddOutputDevice(this); |
| #if ENGINE_MAJOR_VERSION < 5 || (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION < 7) |
| GLog->SerializeBacklog(this); |
| #endif |
| } |
|
|
| void FRiderOutputDevice::TearDown() |
| { |
| FScopeLock Lock{&CriticalSection}; |
|
|
| if(onSerializeMessage.IsBound() == false) return; |
|
|
| onSerializeMessage.Unbind(); |
| } |
|
|