MCPcopy Create free account
hub / github.com/20tab/UnrealEnginePython / CreateLogMessages

Method CreateLogMessages

Source/PythonConsole/Private/SPythonLog.cpp:389–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

387}
388
389bool SPythonLog::CreateLogMessages(const TCHAR* V, ELogVerbosity::Type Verbosity, const class FName& Category, TArray< TSharedPtr<FLogMessage> >& OutMessages)
390{
391 if (Verbosity == ELogVerbosity::SetColor)
392 {
393 // Skip Color Events
394 return false;
395 }
396 else
397 {
398 FName Style;
399 if (Category == NAME_Cmd)
400 {
401 Style = FName(TEXT("Log.Command"));
402 }
403 else if (Verbosity == ELogVerbosity::Error)
404 {
405 Style = FName(TEXT("Log.Error"));
406 }
407 else if (Verbosity == ELogVerbosity::Warning)
408 {
409 Style = FName(TEXT("Log.Warning"));
410 }
411 else
412 {
413 Style = FName(TEXT("Log.Normal"));
414 }
415
416 // Determine how to format timestamps
417 static ELogTimes::Type LogTimestampMode = ELogTimes::None;
418 if (UObjectInitialized() && !GExitPurge)
419 {
420 // Logging can happen very late during shutdown, even after the UObject system has been torn down, hence the init check above
421 LogTimestampMode = GetDefault<UEditorStyleSettings>()->LogTimestampMode;
422 }
423
424 const int32 OldNumMessages = OutMessages.Num();
425
426 // handle multiline strings by breaking them apart by line
427 TArray<FTextRange> LineRanges;
428 FString CurrentLogDump = V;
429 FTextRange::CalculateLineRangesFromString(CurrentLogDump, LineRanges);
430
431 bool bIsFirstLineInMessage = true;
432 for (const FTextRange& LineRange : LineRanges)
433 {
434 if (!LineRange.IsEmpty())
435 {
436 FString Line = CurrentLogDump.Mid(LineRange.BeginIndex, LineRange.Len());
437 Line = Line.ConvertTabsToSpaces(4);
438
439 OutMessages.Add(MakeShareable(new FLogMessage(MakeShareable(new FString(Line)), Style)));
440
441 bIsFirstLineInMessage = false;
442 }
443 }
444
445 return OldNumMessages != OutMessages.Num();
446 }

Callers

nothing calls this directly

Calls 1

FNameClass · 0.70

Tested by

no test coverage detected