Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileViewer: fix coloration issue for logs files. #2299

Merged
merged 5 commits into from
Jan 26, 2024

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Jan 26, 2024

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Complement for #2283.
Coloration was not working for logs file filled by the SDK since the format is not the same than on logcat files.

Motivation and context

Better readable log file.

Screenshots / GIFs

image

Tests

  • Open a logs file from the nightly and see that coloration does not work.
  • With this PR it will work, but keep in mind that logs file are not generated on debug build.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

@bmarty bmarty requested a review from a team as a code owner January 26, 2024 10:48
@bmarty bmarty requested review from jmartinesp and removed request for a team January 26, 2024 10:48
Copy link
Contributor

github-actions bot commented Jan 26, 2024

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/jHF74t

* ^ use this char to determine the color
* Ex for logs:
* `2024-01-26T10:22:26.947416Z WARN elementx: Restore with non-empty map | MatrixClientsHolder.kt:68`
* ^ use this char to determine the color, see [LogLevel]
Copy link
Member Author

Choose a reason for hiding this comment

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

Use the last char since the level name is always 5 chars with end alignment. So we could not make the diff between INFO and WARN.

Copy link

codecov bot commented Jan 26, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (80270d1) 70.04% compared to head (6194f2c) 70.07%.

Files Patch % Lines
...roid/features/viewfolder/impl/file/ViewFileView.kt 87.50% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2299      +/-   ##
===========================================
+ Coverage    70.04%   70.07%   +0.03%     
===========================================
  Files         1353     1353              
  Lines        33194    33236      +42     
  Branches      6870     6877       +7     
===========================================
+ Hits         23250    23291      +41     
- Misses        6637     6638       +1     
  Partials      3307     3307              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! I have a couple of nits, nothing important, so feel free to ignore them.


enum class ColorationMode {
Logcat,
Logs,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this could be TracingLogs/RustLogs?

Copy link
Member Author

Choose a reason for hiding this comment

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

Comment on lines 221 to 225
'D' -> Color(0xFF299999)
'I' -> Color(0xFFABC023)
'W' -> Color(0xFFBBB529)
'E' -> Color(0xFFFF6B68)
'A' -> Color(0xFFFF6B68)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe the colors used here could be extracted? Most of them are shared.

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -51,5 +51,6 @@ fun aViewFileState(
) = ViewFileState(
name = name,
lines = lines,
colorationMode = ColorationMode.Logcat,
Copy link
Member

Choose a reason for hiding this comment

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

Should we have another preview with the other mode?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, 7efbee8 and this has revealed a bug!

@bmarty bmarty added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Jan 26, 2024
@bmarty bmarty enabled auto-merge January 26, 2024 13:58
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Jan 26, 2024
Copy link

sonarcloud bot commented Jan 26, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@bmarty bmarty disabled auto-merge January 26, 2024 15:34
@bmarty bmarty merged commit 0bcd3ba into develop Jan 26, 2024
15 checks passed
@bmarty bmarty deleted the feature/bma/logViewerImprovement branch January 26, 2024 15:34
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.

2 participants