Fix multi-line logs on Windows regression from cf94cd937a
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
#include "Engine/Platform/FileSystem.h"
|
||||
#include "Engine/Platform/CriticalSection.h"
|
||||
#include "Engine/Serialization/FileWriteStream.h"
|
||||
#include "Engine/Serialization/MemoryWriteStream.h"
|
||||
#include "Engine/Debug/Exceptions/Exceptions.h"
|
||||
#if USE_EDITOR
|
||||
#include "Engine/Core/Collections/Array.h"
|
||||
@@ -210,17 +209,18 @@ void Log::Logger::ProcessLogMessage(LogType type, const StringView& msg, fmt_fla
|
||||
hasWindowsNewLine |= msg.Get()[i - 1] != '\r' && msg.Get()[i] == '\n';
|
||||
if (hasWindowsNewLine)
|
||||
{
|
||||
MemoryWriteStream msgStream(msgLength * sizeof(Char));
|
||||
msgStream.WriteChar(msg.Get()[0]);
|
||||
Array<Char> msgStream;
|
||||
msgStream.EnsureCapacity(msgLength);
|
||||
msgStream.Add(msg.Get()[0]);
|
||||
for (int32 i = 1; i < msgLength; i++)
|
||||
{
|
||||
if (msg.Get()[i - 1] != '\r' && msg.Get()[i] == '\n')
|
||||
msgStream.WriteChar(TEXT('\r'));
|
||||
msgStream.WriteChar(msg.Get()[i]);
|
||||
msgStream.Add(TEXT('\r'));
|
||||
msgStream.Add(msg.Get()[i]);
|
||||
}
|
||||
msgStream.WriteChar(TEXT('\0'));
|
||||
w.append((const Char*)msgStream.GetHandle(), (const Char*)msgStream.GetHandle() + msgStream.GetPosition());
|
||||
//fmt_flax::format(w, TEXT("{}"), (const Char*)msgStream.GetHandle());
|
||||
msgStream.Add(TEXT('\0'));
|
||||
w.append(msgStream.Get(), (const Char*)(msgStream.Get() + msgStream.Count()));
|
||||
//fmt_flax::format(w, TEXT("{}"), (const Char*)msgStream.Get());
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user