Skip to content

Add device attributes to Logs in the MAUI SDK #4733

Description

@dalnoki

Problem Statement

The Sentry MAUI SDK currently does not include device-specific attributes (such as device.model, device.platform, device.manufacturer, and device.brand) in structured logs, even though this information is collected and sent with error events and issues.

Solution Brainstorm

No response

Activity

  1. added
    FeatureNew feature or request
    .NETPull requests that update .net code
    on Nov 13, 2025
  2. linear commented on Nov 13, 2025

    @linear
  3. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Nov 13, 2025
  4. self-assigned this
    on Nov 17, 2025
  5. munkii commented on Nov 20, 2025

    @munkii

    As the customer that triggered support rasing this ticket I thought I'd had some background. As it currently stands the logs and more importantly the lack of supplementary data mean they really only work in the scope of a single developer with one maybe two devices.

    As soon as QA or production gets involved we need to know what devices are triggering which logs and that is impossible at the moment.

  6. munkii commented on Nov 21, 2025

    @munkii

    As a workaround I haved changed SetBeforeSendLog to read the User details out of Scope and then apply them to Log with SetAttribute

    options.Experimental.SetBeforeSendLog(log =>
    {
    #if DEBUG
       SentryLogLevel minimumLevel = SentryLogLevel.Debug;
    #else
       SentryLogLevel minimumLevel = SentryLogLevel.Info;
    #endif
    
       log.SetAttribute("DeviceName", DeviceInfo.Name);
       log.SetAttribute("Manufacturer", DeviceInfo.Manufacturer);
       log.SetAttribute("OSVersion", DeviceInfo.VersionString);
       log.SetAttribute("DeviceModel", DeviceInfo.Model);
    
       SentryUser sentryUser = null; ;
    
    
       SentrySdk.ConfigureScope(scope =>
       {
       	if (scope.HasUser())
       	{
       		sentryUser = scope.User;
       	}
    
       });
    
       if (sentryUser != null) {
       	log.SetAttribute("UserId", sentryUser.Id);
       	log.SetAttribute("UserName", sentryUser.Username);
       }
    
       if (log.Level < minimumLevel)
       {
       	return null;
       }
       
       return log;
    });
    
  7. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .net codeFeatureNew feature or requestLogs

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions