Skip to content

Conversation

@tustanivsky
Copy link
Collaborator

@tustanivsky tustanivsky commented Jan 20, 2026

This PR adds an automatic category attribute to structured logs unless it is explicitly provided by the user. This allows more efficient log filtering and provides an experience similar to the Unreal Editor.

Key changes:

  • Move log message formatting from platform implementations to USentrySubsystem::AddLog to reduce code duplication
  • Simplify internal ISentrySubsystem::AddLog interface by removing Category parameter
  • Automatically add category attribute to structured logs unless explicitly provided by user

Related items:

@github-actions
Copy link
Contributor

github-actions bot commented Jan 20, 2026

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Internal Changes 🔧

Deps

  • Update Android Gradle Plugin to v6.0.0 by github-actions in #1208
  • Update Native SDK to v0.12.4 by github-actions in #1209
  • Update Cocoa SDK (iOS and Mac) to v9.2.0 by github-actions in #1201
  • Update Java SDK (Android) to v8.31.0 by github-actions in #1202
  • Update Java SDK (Android) to v8.30.0 by github-actions in #1196
  • Update CLI to v3.1.0 by github-actions in #1192

Release

  • Fix changelog-preview permissions by BYK in #1206
  • Switch from action-prepare-release to Craft by BYK in #1189

Other

  • (repo) Add Claude Code settings with basic permissions by philipphofmann in #1198

Other

  • Add category as attribute to structured logs by tustanivsky in #1199
  • Fix infinite loop in FSentryErrorOutputDevice::Serialize on re-entrant assert by tustanivsky in #1197

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 20, 2026

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 2d34c28

@tustanivsky tustanivsky marked this pull request as ready for review January 20, 2026 08:50
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

FinalAttributes.Add(TEXT("category"), Category);
}

SubsystemNativeImpl->AddLog(FormattedMessage, Level, FinalAttributes);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Category attribute breaks global attribute preservation

Medium Severity

On Windows/Linux, when a user provides a category but no explicit per-log attributes, global attributes set via SetAttribute() are no longer included in the log. The automatic category attribute causes Attributes.Num() > 0 to be true in the platform implementation, which triggers creation of a non-null attributes object. Per the code comment, passing null preserves global attributes, but passing non-null does not. Before this change, LogDebug("msg", "cat") would preserve global attributes; now it loses them.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like an issue in sentry-native (getsentry/sentry-native#1485) which should probably be addressed before moving on with these changes in Unreal.

On Mac, global and per-log attributes are merged properly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be addressed via getsentry/sentry-native#1486

@tustanivsky tustanivsky merged commit dc14c40 into main Jan 27, 2026
103 of 104 checks passed
@tustanivsky tustanivsky deleted the feat/log-category-as-attr branch January 27, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants