Skip to content
Snippets Groups Projects
Commit a5dc8c43 authored by Jonathan Ehret's avatar Jonathan Ehret
Browse files

Merge branch 'feature/fix-logging-and-allow-closing' into 'develop'

remove all streams on session end, so that logging into a not created stream...

See merge request !20
parents dff62047 38d3784f
No related branches found
No related tags found
1 merge request!20remove all streams on session end, so that logging into a not created stream...
Pipeline #352569 failed
......@@ -62,3 +62,8 @@ void UUniLogBlueprintFunctionLibrary::ModifyLogStream(const FString StreamName,
LogStream->SetLogOnScreenOnMaster(bLogOnScreenOnMaster);
LogStream->SetLogOnScreenOnSlaves(bLogOnScreenOnSlaves);
}
void UUniLogBlueprintFunctionLibrary::CloseLogStream(const FString StreamName)
{
UniLog.CloseLogStream(StreamName);
}
\ No newline at end of file
......@@ -71,6 +71,8 @@ void UniversalLoggingImpl::OnSessionEnd(const bool)
{
Elem.Value->Close();
}
Streams.Empty();
}
void UniversalLoggingImpl::OnPostActorTick(UWorld* World, ELevelTick LevelTick, float WhateverThisIsDeltaTimeMaybe)
......@@ -106,6 +108,15 @@ ILogStream* UniversalLoggingImpl::NewLogStream(const FString StreamName, const F
return Streams[StreamName].Get();
}
void UniversalLoggingImpl::CloseLogStream(const FString StreamName)
{
if(Streams.Contains(StreamName))
{
Streams[StreamName]->Close();
Streams.Remove(StreamName);
}
}
ILogStream * UniversalLoggingImpl::GetLogStream(const FString StreamName)
{
if (Streams.Contains(StreamName))
......
......@@ -25,6 +25,7 @@ public:
ILogStream* NewLogStream(const FString StreamName, const FString Filepath, const FString Filename,
bool bPer_Session = false, const bool bLogOnMaster = true,
const bool bLogOnSlaves = false) override;
void CloseLogStream(const FString StreamName) override;
ILogStream* GetLogStream(const FString StreamName) override;
ILogStream* GetDefaultLogStream() override;
FString GetSessionIdentifier() override;
......
......@@ -47,6 +47,12 @@ public:
bool bPer_Session = false, const bool bLogOnMaster = true,
const bool bLogOnSlaves = false) = 0;
/**
* Closes a specific named log stream.
* This is done by default when a session stops, but can also be done manually if needed
*/
virtual void CloseLogStream(const FString StreamName) = 0;
/**
* Getter for log streams.
*
......
......@@ -37,4 +37,7 @@ class UUniLogBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
FColor OnScreenBackgroundColor = FColor(0, 0, 0, 128), float OnScreenSize = 1.0,
float OnScreenDuration = 5.0, bool bLogToDefaultLog = false, bool bLogOnScreenOnMaster = true,
bool bLogOnScreenOnSlaves = false);
UFUNCTION(BlueprintCallable, Category = "UniLog")
static void CloseLogStream(const FString StreamName);
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment