I am currently working on an extended logging system and want to include different selectable categories for the logs.
The goal is that developers can call the function, include the message and specify the category of the log.
I already set this up using Enums and a lookup TMap to convert the Enum into a FString for the Logs.
For slight performance improvements I would prefer to directly provide a FString value in the function parameters while keeping a dropdown selection of allowed values in the Editor.
Is this possible / is there specific metadata which could be used for this case?
Current setup (inside of a Blueprint Function Library):
UFUNCTION(BlueprintCallable)
static void LogWarning(FString LogMessage, ELogCategory LogCategory)
{
UE_LOG(CILogger, Log, TEXT("WARNING %s : %s"),*LogCategoryTextsMap.FindRef(LogCategory),*LogMessage)
}
LogCategoryTextsMap definition:
const TMap<ELogCategory,FString> LogCategoryTextsMap = {
{ELogCategory::CAT_DEFAULT,""},
{ELogCategory::CAT_AI,"AI"},
{ELogCategory::CAT_COLLISION,"Collision"},
{ELogCategory::CAT_LIGHTNING,"Lightning"}
};