Advanced Configuration

Basic attributes can be reconfigured by providing a special game data to the crash reporter by setting the __sentry game data key to a JSON value containing Sentry specific attributes:

Copied
#include "GenericPlatform/GenericPlatformCrashContext.h"
#include "Dom/Json.h"

void ConfigureCrashReporter()
{
    TSharedPtr<FJsonObject> config = MakeShareable(new FJsonObject);

    // sentry specific attributes to here
    config->SetStringField("release", "my-project-name@2.3.12");
    config->SetStringField("environment", "production");

    FString jsonConfig;
    TSharedRef<TJsonWriter<>> jsonWriter = TJsonWriterFactory<>::Create(&jsonConfig);
    FJsonSerializer::Serialize(config, jsonWriter);

    FGenericCrashContext::SetGameData(TEXT("__sentry"), jsonConfig);
}

You need to call the ConfigureCrashReporter some time after your game starts up. Any event attribute can be set.

Depending on the version of Unreal Engine you are using, you may have to add JSON support to the build script (MyProject.build.cs):

Copied
PublicDependencyModuleNames.AddRange(new string[] { ..., "Json" });
You can edit this page on GitHub.