MCPcopy Create free account
hub / github.com/ProjectBorealis/UEGitPlugin / FTSMessageLog

Class FTSMessageLog

Source/GitSourceControl/Private/GitMessageLog.h:19–113  ·  view source on GitHub ↗

* A thread safe replacement for FMessageLog which can be called from background threads. * It only exposes methods from FMessageLog that we would be able to safely delay, such * as messages. We do not provide any functionality to open error dialogs etc. * At the moment if we detect a message is being queued when not on the game thread we log * it instead of sending to the FMessageLog system.

Source from the content-addressed store, hash-verified

17 * and marshal them to the GameThread so that they can be displayed as originally intended.
18 */
19class FTSMessageLog
20{
21public:
22 FTSMessageLog() = delete;
23 FTSMessageLog(const FName& InLogName)
24 : Log(InLogName)
25 {}
26
27 FTSMessageLog(FTSMessageLog&&) = default;
28 FTSMessageLog& operator = (FTSMessageLog&&) = default;
29
30 FTSMessageLog(const FTSMessageLog&) = delete;
31 FTSMessageLog& operator = (const FTSMessageLog&) = delete;
32
33 ~FTSMessageLog() = default;
34
35 TSharedRef<FTokenizedMessage> Message(EMessageSeverity::Type InSeverity, const FText& InMessage = FText())
36 {
37 if (IsInGameThread())
38 {
39 return Log.Message(InSeverity, InMessage);
40 }
41 else
42 {
43 TSharedRef<FTokenizedMessage> Message = FTokenizedMessage::Create(InSeverity, InMessage);
44 UE_LOG(LogSourceControl, Display, TEXT("%s"), *Message->ToText().ToString());
45
46 return Message;
47 }
48 }
49
50 TSharedRef<FTokenizedMessage> Error(const FText& InMessage = FText())
51 {
52 if (IsInGameThread())
53 {
54 return Log.Error(InMessage);
55 }
56 else
57 {
58 TSharedRef<FTokenizedMessage> Message = FTokenizedMessage::Create(EMessageSeverity::Error, InMessage);
59 UE_LOG(LogSourceControl, Error, TEXT("%s"), *Message->ToText().ToString());
60
61 return Message;
62 }
63 }
64
65 TSharedRef<FTokenizedMessage> PerformanceWarning(const FText& InMessage = FText())
66 {
67 if (IsInGameThread())
68 {
69 return Log.PerformanceWarning(InMessage);
70 }
71 else
72 {
73 TSharedRef<FTokenizedMessage> Message = FTokenizedMessage::Create(EMessageSeverity::PerformanceWarning, InMessage);
74 UE_LOG(LogSourceControl, Warning, TEXT("%s"), *Message->ToText().ToString());
75
76 return Message;

Callers 2

ExecuteMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected