Now echoing Luprex console messages to the Unreal Log as well. Had to make them warnings in order to make them more visible, which in turn meant I had to modify the BreakToDebugger system to be able to ignore these console messages.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include "BreakToDebugger.h"
|
||||
#include "Blueprint/BlueprintExceptionInfo.h"
|
||||
#include "Kismet2/KismetDebugUtilities.h"
|
||||
#include "LuprexEditorSettings.h"
|
||||
|
||||
ELogVerbosity::Type FlxBreakToDebuggerOutputDevice::ConvertThreshold(ElxBreakToDebuggerThreshold Verbosity) {
|
||||
switch (Verbosity) {
|
||||
@@ -15,8 +16,8 @@ ELogVerbosity::Type FlxBreakToDebuggerOutputDevice::ConvertThreshold(ElxBreakToD
|
||||
}
|
||||
}
|
||||
|
||||
FlxBreakToDebuggerOutputDevice::FlxBreakToDebuggerOutputDevice(const ElxBreakToDebuggerThreshold &SensitivityRef)
|
||||
: Sensitivity(SensitivityRef)
|
||||
FlxBreakToDebuggerOutputDevice::FlxBreakToDebuggerOutputDevice()
|
||||
: Settings(GetDefault<UlxEditorSettings>())
|
||||
{
|
||||
GLog->AddOutputDevice(this);
|
||||
}
|
||||
@@ -48,7 +49,7 @@ void FlxBreakToDebuggerOutputDevice::Serialize(const TCHAR* V, ELogVerbosity::Ty
|
||||
{
|
||||
// If the error isn't serious enough, do nothing.
|
||||
//
|
||||
if (Verbosity > ConvertThreshold(Sensitivity))
|
||||
if (Verbosity > ConvertThreshold(Settings->BreakToDebuggerLogVerbosity))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -67,6 +68,13 @@ void FlxBreakToDebuggerOutputDevice::Serialize(const TCHAR* V, ELogVerbosity::Ty
|
||||
UObject *TopObject = Frame->Object;
|
||||
if (TopObject == nullptr) return;
|
||||
|
||||
// If the category is in the exclude list, do nothing.
|
||||
//
|
||||
if (Settings->BreakToDebuggerExcludeCategories.Contains(Category))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Notify the debugger that there's been an exception.
|
||||
//
|
||||
FBlueprintExceptionInfo ExceptionInfo(EBlueprintExceptionType::Breakpoint, FText::FromStringView(FStringView(V)));
|
||||
|
||||
@@ -79,19 +79,15 @@ enum class ElxBreakToDebuggerThreshold : uint8 {
|
||||
};
|
||||
|
||||
|
||||
class UlxEditorSettings;
|
||||
|
||||
struct FlxBreakToDebuggerOutputDevice : public FOutputDevice
|
||||
{
|
||||
public:
|
||||
// The constructor and destructor automatically register
|
||||
// this output device with GLog.
|
||||
//
|
||||
// This struct doesn't store the sensitivity threshold.
|
||||
// It relies on the LuprexGameMode class to do that, so
|
||||
// that the threshold can be easily edited with the
|
||||
// blueprint editor. This struct must be initialized
|
||||
// with a reference to the threshold variable.
|
||||
//
|
||||
FlxBreakToDebuggerOutputDevice(const ElxBreakToDebuggerThreshold &SensitivityRef);
|
||||
FlxBreakToDebuggerOutputDevice();
|
||||
~FlxBreakToDebuggerOutputDevice();
|
||||
|
||||
// Inspect a log message.
|
||||
@@ -109,5 +105,5 @@ public:
|
||||
|
||||
private:
|
||||
static ELogVerbosity::Type ConvertThreshold(ElxBreakToDebuggerThreshold Verbosity);
|
||||
const ElxBreakToDebuggerThreshold &Sensitivity;
|
||||
const UlxEditorSettings *Settings = nullptr;
|
||||
};
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
|
||||
DEFINE_LOG_CATEGORY(LogLuprex);
|
||||
DEFINE_LOG_CATEGORY(LogLuprexIntegration);
|
||||
DEFINE_LOG_CATEGORY(LogLuprexConsole);
|
||||
|
||||
@@ -153,3 +153,7 @@ DECLARE_LOG_CATEGORY_EXTERN(LogLuprex, Display, All);
|
||||
// Messages about the Luprex integration with Unreal.
|
||||
//
|
||||
DECLARE_LOG_CATEGORY_EXTERN(LogLuprexIntegration, Display, All);
|
||||
|
||||
// Messages from the Luprex console.
|
||||
//
|
||||
DECLARE_LOG_CATEGORY_EXTERN(LogLuprexConsole, Display, All);
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
#include "LuprexEditorSettings.h"
|
||||
#include "Common.h"
|
||||
|
||||
UlxEditorSettings::UlxEditorSettings()
|
||||
{
|
||||
BreakToDebuggerExcludeCategories.Add(LogLuprexConsole.GetCategoryName());
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ class INTEGRATION_API UlxEditorSettings : public UDeveloperSettings
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UlxEditorSettings();
|
||||
|
||||
virtual FName GetContainerName() const override { return TEXT("Editor"); }
|
||||
virtual FName GetCategoryName() const override { return TEXT("Luprex"); }
|
||||
virtual FName GetSectionName() const override { return TEXT("Settings"); }
|
||||
@@ -39,5 +41,9 @@ public:
|
||||
// severity, the blueprint debugger will automatically pause with a breakpoint.
|
||||
UPROPERTY(Config, EditAnywhere, Category="Debugging Tools")
|
||||
ElxBreakToDebuggerThreshold BreakToDebuggerLogVerbosity;
|
||||
|
||||
// Log categories in this set are excluded from BreakToDebugger triggering.
|
||||
UPROPERTY(Config, EditAnywhere, Category="Debugging Tools")
|
||||
TSet<FName> BreakToDebuggerExcludeCategories;
|
||||
};
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@ void ALuprexGameModeBase::InitializeGlobalState()
|
||||
|
||||
// If somebody generates a log message that's severe enough, break to debugger.
|
||||
BreakToDebuggerLogVerbosityDevice.Reset(
|
||||
new FlxBreakToDebuggerOutputDevice(GetDefault<UlxEditorSettings>()->BreakToDebuggerLogVerbosity));
|
||||
new FlxBreakToDebuggerOutputDevice());
|
||||
}
|
||||
|
||||
void ALuprexGameModeBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
||||
|
||||
@@ -242,3 +242,8 @@ void UlxUtilityLibrary::ValidateLuaExpr(
|
||||
Status = w.ValidateLuaExpr(Code, ErrorMessage);
|
||||
}
|
||||
|
||||
void UlxUtilityLibrary::LogLuprexConsoleMessage(const FString &Message)
|
||||
{
|
||||
UE_LOG(LogLuprexConsole, Warning, TEXT("%s"), *Message);
|
||||
}
|
||||
|
||||
|
||||
@@ -144,4 +144,9 @@ public:
|
||||
//
|
||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = "Luprex|Utility")
|
||||
static void ValidateLuaExpr(ElxLuaSyntaxCheck &Status, FString &ErrorMessage, UObject *context, const FString &Code);
|
||||
|
||||
// Log a message to the LogLuprexConsole category.
|
||||
//
|
||||
UFUNCTION(BlueprintCallable, Category = "Luprex|Utility")
|
||||
static void LogLuprexConsoleMessage(const FString &Message);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user