23 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLockerServer")
24 FString LootLockerServerKey = "";
25 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category = "LootLockerServer")
26 FString LootLockerDomainKey = "";
27 UPROPERTY(Config, VisibleAnywhere, BlueprintReadOnly, Category = "LootLockerServer",
Meta = (EditCondition = "IsLegacyKey", EditConditionHides),
Meta = (MultiLine = true),
Meta = (DisplayName = "WARNING:"), Transient)
28 FString LegacyKeyWarning = "You are using a legacy API Key, please generate a new one here: https:
29 UPROPERTY(Config, VisibleAnywhere, BlueprintReadOnly, Category = "LootLockerServer",
Meta = (EditCondition = "!IsValidGameVersion", EditConditionHides),
Meta = (MultiLine = true),
Meta = (DisplayName = "WARNING:"), Transient)
30 FString InvalidGameVersionWarning = "";
31 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category = "LootLockerServer")
32 FString GameVersion = "";
33 UPROPERTY(Config, VisibleAnywhere, BlueprintReadOnly,
Meta = (EditCondition = "false", EditConditionHides), Category = "LootLockerServer")
34 FString LootLockerVersion = "2021-06-01";
36 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category = "LootLockerServer|Logging")
37 ELootLockerServerLogLevel LimitLogLevelTo = ELootLockerServerLogLevel::Display;
38 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category = "LootLockerServer|Logging")
39 bool LogOutsideOfEditor = false;
40 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category = "LootLockerServer|Logging")
41 bool bEnableFileLogging = false;
42 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category = "LootLockerServer|Logging")
43 FString LogFileName = TEXT("LootLockerServerLog");
44 UPROPERTY(Config, VisibleAnywhere, BlueprintReadOnly, Category = "LootLockerServer|Logging",
Meta = (EditCondition = "bEnableFileLogging", EditConditionHides),
Meta = (MultiLine = true),
Meta = (DisplayName = "Actual Log File (on current device)"), Transient)
45 FString LongLogFilePath = "";
47 FString LogFilePath = "";
50 static ELootLockerServerLogLevel GetConfiguredLogLevel()
52 return GetDefault<ULootLockerServerConfig>()->LimitLogLevelTo;
59 UFUNCTION(BlueprintCallable, Category =
"LootLocker|Logging")
60 static
void SetRuntimeLogLevel(ELootLockerServerLogLevel NewLevel);
65 UFUNCTION(BlueprintCallable, Category = "LootLocker|Logging")
66 static ELootLockerServerLogLevel GetRuntimeLogLevel();
72 UFUNCTION(BlueprintCallable, Category = "LootLocker|Logging")
73 static
void EnableFileLogging(const FString& FileName);
78 UFUNCTION(BlueprintCallable, Category = "LootLocker|Logging")
79 static
void DisableFileLogging();
84 UFUNCTION(BlueprintCallable, Category = "LootLocker|Logging")
85 static
bool IsFileLoggingEnabled();
90 UFUNCTION(BlueprintCallable, Category = "LootLocker|Logging")
91 static FString GetLogFilePath();
96 bool IsLegacyAPIKey()
const
98 return LootLockerServerKey.Find(
"dev_", ESearchCase::CaseSensitive) == -1 && LootLockerServerKey.Find(
"prod_", ESearchCase::CaseSensitive) == -1;
102 static
bool ShouldLog()
107 return GetDefault<ULootLockerServerConfig>()->LogOutsideOfEditor;
112 static
bool IsSemverString(const FString& str)
114#if ENGINE_MAJOR_VERSION >= 5
115 return std::regex_match(TCHAR_TO_UTF8(*str), SemverPattern);
121 virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
override
123 if (PropertyChangedEvent.GetPropertyName() ==
"LootLockerServerKey")
125 IsLegacyKey = IsLegacyAPIKey();
127 if (PropertyChangedEvent.GetPropertyName() ==
"GameVersion")
129 IsValidGameVersion = IsSemverString(GameVersion);
131 if (PropertyChangedEvent.GetPropertyName() ==
"bEnableFileLogging" || PropertyChangedEvent.GetPropertyName() ==
"LogFileName")
133 if (bEnableFileLogging)
135 EnableFileLogging(LogFileName.IsEmpty() ?
"LootLockerServerLog" : LogFileName);
139 DisableFileLogging();
142 UObject::PostEditChangeProperty(PropertyChangedEvent);
145 virtual void PostInitProperties()
override
147 IsLegacyKey = IsLegacyAPIKey();
148 IsValidGameVersion = IsSemverString(GameVersion);
149 if(bEnableFileLogging)
151 EnableFileLogging(LogFileName.IsEmpty() ?
"LootLockerServerLog" : LogFileName);
155 DisableFileLogging();
157 UObject::PostInitProperties();
160 UPROPERTY(Config, VisibleInstanceOnly,
Meta = (EditCondition =
"false", EditConditionHides), Transient, Category =
"LootLockerServer")
161 bool IsLegacyKey = false;
162 UPROPERTY(Config, VisibleInstanceOnly,
Meta = (EditCondition = "false", EditConditionHides), Transient, Category = "LootLockerServer")
163 bool IsValidGameVersion = true;
164#if ENGINE_MAJOR_VERSION >= 5
165 inline static const std::regex SemverPattern = std::regex(
"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:\\.(0|[1-9]\\d*))?(?:\\.(0|[1-9]\\d*))?$");