Improved (?) Logging macro available since Unreal Engine 5.2. Mostly the same as UE_LOG, but uses different format for the log format string.
- Doesn’t use the
TEXT
macro anymore - Uses the same Log Levels
- Uses the same Log Categories
- Uses FCbWriter for converting parameters into the log string, so you can implement a custom serializer for logging purposes. Somewhat unclear if the CbWriter is also used for other purposes.
//positional params
UE_LOGFMT(LogTemp, Warning, "Hello {0} {1}", Param0, Param1);
//named params
UE_LOGFMT(LogWhatever, Error, "Hello {Foo} {Bar}", ("Foo", Param0), ("Bar", Param1));
//You can also use named parameters without specifying the name, which might
//be the best way to use this macro because you get useful names in the format
//string without the extra verbosity, since chances are the order doesn't matter
//that much
UE_LOGFMT(LogWhatever, Error, "Hello {Foo} {Bar}", Param0, Param1);
Formatting
Apparently supports using this, but I haven’t tried myself https://en.cppreference.com/w/cpp/utility/format/formatter