Skip to content
Snippets Groups Projects
Commit 639d2a9e authored by mbellgardt's avatar mbellgardt
Browse files

Add a Prefix to LogStreams to distinguish different streams in the same file.

parent 7c369b5b
Branches
No related tags found
2 merge requests!16Develop,!6Feature/multiple streams per file
......@@ -48,6 +48,16 @@ FString LogStreamImpl::GetFilename()
return Filename;
}
void LogStreamImpl::SetPrefix(FString Prefix)
{
MessagePrefix = Prefix;
}
FString LogStreamImpl::GetPrefix() const
{
return MessagePrefix;
}
void LogStreamImpl::SetOnScreen(const bool Val)
{
bOnScreen = Val;
......@@ -177,5 +187,5 @@ void LogStreamImpl::Write(const FString Text)
return;
if (!Log_File_Stream->GetIsOpen())
Open();
Log_File_Stream->Write(Text);
Log_File_Stream->Write(MessagePrefix + Text);
}
\ No newline at end of file
......@@ -16,6 +16,9 @@ public:
FString GetFilepath() override;
FString GetFilename() override;
void SetPrefix(FString Prefix) override;
FString GetPrefix() const override;
void SetOnScreen(const bool Val) override;
bool GetOnScreen() const override;
void SetOnScreenColor(const FColor Color) override;
......@@ -48,6 +51,7 @@ public:
private:
const FString Filepath;
const FString Filename;
FString MessagePrefix;
bool bPer_Session;
bool bOnScreen;
......
......@@ -26,7 +26,7 @@ FString UUniLogBlueprintFunctionLibrary::GetSessionIdentifier()
}
void UUniLogBlueprintFunctionLibrary::NewLogStream(const FString StreamName, const FString Filepath,
const FString Filename, bool bPer_Session, bool bOnScreen/* = false*/,
const FString Filename, FString Prefix, bool bPer_Session, bool bOnScreen/* = false*/,
FColor OnScreenColor/* = FColor(0, 0, 255, 0)*/,
FColor OnScreenBackgroundColor, float OnScreenSize,
float OnScreenDuration,
......@@ -36,6 +36,7 @@ void UUniLogBlueprintFunctionLibrary::NewLogStream(const FString StreamName, con
bool bLogOnScreenOnSlaves/* = false*/)
{
auto LogStream = UniLog.NewLogStream(StreamName, Filepath, Filename, bPer_Session, bLogOnMaster, bLogOnSlaves);
LogStream->SetPrefix(Prefix);
LogStream->SetOnScreen(bOnScreen);
LogStream->SetOnScreenColor(OnScreenColor);
LogStream->SetOnScreenBackgroundColor(OnScreenBackgroundColor);
......
......@@ -7,6 +7,9 @@ public:
virtual FString GetFilename() = 0;
virtual bool GetIsValid() = 0;
virtual void SetPrefix(FString Prefix) = 0;
virtual FString GetPrefix() const = 0;
virtual void SetOnScreen(const bool Val) = 0;
virtual bool GetOnScreen() const = 0;
virtual void SetOnScreenColor(const FColor Color) = 0;
......
......@@ -23,7 +23,7 @@ class UUniLogBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
static FString GetSessionIdentifier();
UFUNCTION(BlueprintCallable, Category = "UniLog")
static void NewLogStream(const FString StreamName, const FString Filepath, const FString Filename,
static void NewLogStream(const FString StreamName, const FString Filepath, const FString Filename, FString Prefix,
bool bPer_Session = false, bool bOnScreen = false,
FColor OnScreenColor = FColor(255, 255, 255, 255),
FColor OnScreenBackgroundColor = FColor(0, 0, 0, 128),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment