Lots of refactors related to BreakToDebugger and FormatLogMessage

This commit is contained in:
2026-02-14 01:25:04 -05:00
parent 96256d7836
commit dd159b064d
10 changed files with 221 additions and 162 deletions

View File

@@ -2,7 +2,7 @@
#pragma once
#include "BlueprintErrors.h"
#include "BreakToDebugger.h"
#include "FormatDataLibrary.h"
#include "Containers/Array.h"
#include "CoreMinimal.h"
@@ -14,10 +14,51 @@
#include "UObject/NameTypes.h"
#include "UObject/ObjectMacros.h"
#include "UObject/UObjectGlobals.h"
#include "BlueprintErrors.h"
#include "FormatMessage.generated.h"
/** Format Log Verbosity: controls how a message from the "Format Log Message"
* K2Node gets written to the log.
*
* 'Fatal' is deliberately placed at the end so that the editor defaults to
* 'Error' (value 0) when the dropdown is uninitialized. This means the
* numeric values don't match ELogVerbosity, so a conversion function is needed.
*
* ThrottledDisplay and ThrottledLog behave like Display and Log respectively,
* but suppress repeated messages with the same format pattern, logging at most
* once per second.
*/
UENUM(BlueprintType)
enum class ElxFormatLogVerbosity : uint8 {
/* Prints an error to the console and log file. The editor collects and reports errors. */
Error,
/* Prints a warning to the console and log file. The editor collects and report warnings. */
Warning,
/* Prints a message to the console and log file. */
Display,
/* Prints a message to the log file, however, it does not print to the console. */
Log,
/* Like Display, but suppresses repeated messages with the same format pattern (at most once per second). */
ThrottledDisplay,
/* Like Log, but suppresses repeated messages with the same format pattern (at most once per second). */
ThrottledLog,
/* Prints a message to a log file only if Verbose logging is enabled for the given category. This is usually used for detailed logging. */
Verbose,
/* Prints a message to a log file. If VeryVerbose logging is enabled, then this is used for detailed logging that would otherwise spam output. */
VeryVerbose,
/* Danger! Prints a fatal error to the console and log file, then crashes (this crashes the editor too). */
Fatal,
};
class FBlueprintActionDatabaseRegistrar;
class FString;
class UEdGraph;
@@ -82,7 +123,10 @@ protected:
// function, which formats the message and outputs it to the log.
//
UFUNCTION(BlueprintCallable, meta=(WorldContext = "Context", BlueprintInternalUseOnly = "true"))
static void FormatLogMessageInternal(UObject *Context, ElxLogVerbosity Verbosity, const FString &InPattern, TArray<FFormatArgumentData> InArgs);
static void FormatLogMessageInternal(UObject *Context, ElxFormatLogVerbosity Verbosity, const FString &InPattern, TArray<FFormatArgumentData> InArgs);
private:
static ELogVerbosity::Type ConvertElxFormatLogVerbosity(ElxFormatLogVerbosity Verbosity);
protected:
/** When adding arguments to the node, their names are placed here and are generated as pins during construction */