Add attributes support for structured logs#1190
Merged
tustanivsky merged 41 commits intomainfrom Jan 16, 2026
Merged
Conversation
…eal into feat/log-attributes # Conflicts: # plugin-dev/Source/Sentry/Private/Apple/Infrastructure/AppleSentryConverters.cpp
Contributor
|
plugin-dev/Source/Sentry/Private/GenericPlatform/GenericPlatformSentrySubsystem.cpp
Outdated
Show resolved
Hide resolved
...dev/Source/Sentry/Private/GenericPlatform/Infrastructure/GenericPlatformSentryConverters.cpp
Show resolved
Hide resolved
...dev/Source/Sentry/Private/GenericPlatform/Infrastructure/GenericPlatformSentryConverters.cpp
Outdated
Show resolved
Hide resolved
plugin-dev/Source/Sentry/Private/Apple/Infrastructure/AppleSentryConverters.cpp
Show resolved
Hide resolved
...dev/Source/Sentry/Private/GenericPlatform/Infrastructure/GenericPlatformSentryConverters.cpp
Show resolved
Hide resolved
plugin-dev/Source/Sentry/Private/GenericPlatform/GenericPlatformSentrySubsystem.cpp
Outdated
Show resolved
Hide resolved
plugin-dev/Source/Sentry/Private/GenericPlatform/GenericPlatformSentryLog.cpp
Show resolved
Hide resolved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
mujacica
approved these changes
Jan 16, 2026
tustanivsky
added a commit
to getsentry/sentry-docs
that referenced
this pull request
Jan 16, 2026
This PR documents the new structured logging attributes API for Unreal SDK: - `LogXxxWithAttributes()` methods for attaching custom attributes to individual logs - Global attributes via `SetAttribute()`/`RemoveAttribute()` (with Android limitation note) - Attribute manipulation methods on `USentryLog` for use in `BeforeLogHandler` Also fixes incorrect `AddLog()` references to use the actual public API (`LogDebug()`, `LogInfo()`, etc.). Related items: - getsentry/sentry-unreal#1190
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds support for structured log attributes to Sentry's logging system enabling developers to attach metadata to individual log entries. Attributes are key-value pairs that can be used to add contextual information to logs beyond just the message body, log category and severity level.
It is now possible to capture logs with a given set of attributes (provided as a
TMap<FString, FSentryVariant>) and to get or set individual log item attributes in theBeforeLoghandler. Also, attributes can be set globally, meaning they will be applied to all captured logs.Attributes support all
FSentryVarianttypes:Separate
LogXXXWithAttributesmethods were added toUSentrySubsysteminstead of extending the existingLogXXXmethods, becauseUFUNCTION's parameters of typeTMapcannot have default values. Adding them would therefore introduce a breaking API change which this approach avoids.Closes #1163
Usage examples
Add a log with attributes:
Manipulate attributes in
BeforeLogHandlerSet global attributes:
Other
Logging inside
FSentryVariantwas removed to prevent infinite recursion that could crash the SDK. This could previously happen if variants were misused in a customBeforeLoghandler (e.g. when attempting to get value of the non-existent attribute retrieved usingUSentryLog::GetAttribute).To align SDK behavior across platforms, the
Flushfunction is invoked internally on Android and Apple platforms to ensure all logs are flushed during app shutdown.Testing
Newly added attributes API is covered with unit and integration tests.
Depends on:
Documentation