Skip to content

Conversation

@bricefriha
Copy link
Contributor

@bricefriha bricefriha commented Oct 25, 2024

Context

As issue #3703 reports, Logcats files currently attached to Sentry issues are not previewable.

image

This issue is due to the mime-type sent with the file, as it currently has its own type, text/logcat. However, Sentry's preview component does not support this type.
This PR aims to tackle just that by changing the mime-type we send from text/logcat to text/plain.

image

Caviat

I personally believe that the user should have a more console-like experience when looking at the preview on Sentry. To tackle this, an issue in Sentry's repo is currently open. So, the PR would offer more of a temporary fix than a complete solution.
Therefore, when/if text/logcat gets support, we could change the mime-type back on our end

@github-actions
Copy link
Contributor

github-actions bot commented Oct 25, 2024

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

Generated by 🚫 dangerJS against 978e231

bricefriha added a commit that referenced this pull request Oct 25, 2024
@bricefriha bricefriha force-pushed the feat/#3703_logcat_preview branch from eb64624 to 3106b92 Compare October 29, 2024 05:57
@bricefriha
Copy link
Contributor Author

I can't find a way to get mime-type during device tests.

But it's not like we need to test this since the mime-type been hardcoded anyways

@bricefriha bricefriha marked this pull request as ready for review October 29, 2024 08:01
@jamescrosswell
Copy link
Collaborator

jamescrosswell commented Oct 30, 2024

I can't find a way to get mime-type during device tests.

But it's not like we need to test this since the mime-type been hardcoded anyways

@bricefriha the device tests are just unit tests that get run on Android or iOS by our device runner here:

conf.AddTestAssemblies([
typeof(Sentry.Tests.SentrySdkTests).Assembly,
typeof(Sentry.Extensions.Logging.Tests.LogLevelExtensionsTests).Assembly,
typeof(Sentry.Maui.Tests.SentryMauiOptionsTests).Assembly,
#if ANDROID
typeof(Sentry.Android.AssemblyReader.Tests.AndroidAssemblyReaderTests).Assembly,
#endif
]);

So you don't need to do anything special... just write some unit tests for LogCatAttachmentEventProcessor.Process.

Note: I see that method isn't very testable... it references static methods like OperatingSystem.IsAndroidVersionAtLeast so it might need to be refactored a bit.

@bricefriha bricefriha marked this pull request as draft October 30, 2024 08:50
@bricefriha bricefriha force-pushed the feat/#3703_logcat_preview branch from 67cdfc8 to defbf1a Compare October 30, 2024 12:18
@bricefriha bricefriha marked this pull request as ready for review October 30, 2024 12:51
Copy link
Collaborator

@jamescrosswell jamescrosswell left a comment

Choose a reason for hiding this comment

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

Looks good - thanks @bricefriha !

Just one question - have you actually tested this in an android app to make sure the logs come through OK and can be previewed in Sentry?

@bricefriha
Copy link
Contributor Author

bricefriha commented Oct 31, 2024

have you actually tested this in an android app to make sure the logs come through OK and can be previewed in Sentry?

@jamescrosswell I have tested with the sample we have and it can be previewed in Sentry (as you can see on the screenshot in the description)

@jamescrosswell jamescrosswell merged commit 44d0c69 into main Oct 31, 2024
21 checks passed
@jamescrosswell jamescrosswell deleted the feat/#3703_logcat_preview branch October 31, 2024 23:41
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.

4 participants