[PM-29673] Improved pre-polutated data on the FlightRecorder logs#6616
Open
[PM-29673] Improved pre-polutated data on the FlightRecorder logs#6616
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6616 +/- ##
==========================================
+ Coverage 85.89% 85.96% +0.07%
==========================================
Files 803 801 -2
Lines 57198 57329 +131
Branches 8270 8307 +37
==========================================
+ Hits 49130 49284 +154
+ Misses 5195 5162 -33
- Partials 2873 2883 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
|
Fixed Issues (1)Great job! The following issues were fixed in this Pull Request
|
| serverData?.version?.let { append(" $it") } | ||
| serverData?.environment?.cloudRegion?.let { append(" @ $it") } | ||
| } | ||
| .toString() |
Collaborator
There was a problem hiding this comment.
Can we define all this stuff outside of the BufferedWriter
| .append("\uD83C\uDF29 Server:") | ||
| .apply { | ||
| serverData?.server?.name?.let { append(" $it") } | ||
| ?: append(" Bitwarden Cloud") |
Collaborator
There was a problem hiding this comment.
Can we simplify this:
val serverInfo = StringBuilder()
.append("\uD83C\uDF29 Server:")
.append(" ${serverData?.server?.name ?: "Bitwarden Cloud"}")
.apply {
serverData?.version?.let { append(" $it") }
serverData?.environment?.cloudRegion?.let { append(" @ $it") }
}
.toString()| bw.append(serverInfo) | ||
| bw.newLine() | ||
| bw.append("Fingerprint: ${Build.FINGERPRINT}") | ||
| bw.newLine() |
Collaborator
There was a problem hiding this comment.
I noticed that there is a new appendLine api. What do you think of this?
if (!logFile.exists()) {
logFile.createNewFile()
val ciInfo = buildInfoManager.ciBuildInfo?.takeIf { it.isNotBlank() }
val serverData = serverConfigRepository.serverConfigStateFlow.value?.serverData
val serverInfo = StringBuilder()
.append(serverData?.server?.name ?: "Bitwarden Cloud")
.apply {
serverData?.version?.let { append(" $it") }
serverData?.environment?.cloudRegion?.let { append(" @ $it") }
}
.toString()
val startTime = Instant
.ofEpochMilli(data.startTimeMs)
.toFormattedPattern(pattern = LOG_TIME_PATTERN, clock = clock)
// Upon creating the new file, we pre-populate it with basic data
BufferedWriter(FileWriter(logFile, true)).use { bw ->
bw.appendLine("Bitwarden Android - ${buildInfoManager.applicationName}")
bw.appendLine("Log Start Time: $startTime")
bw.appendLine("Log Duration: ${data.durationMs.milliseconds}")
bw.appendLine("App Version: ${buildInfoManager.versionData}")
bw.appendLine("Build: ${buildInfoManager.buildAndFlavor}")
bw.appendLine("SDK Version: \uD83E\uDD80 ${buildInfoManager.sdkData}")
ciInfo.let { bw.appendLine("CI Build Info: $it") }
bw.appendLine("Device: ${buildInfoManager.deviceData}")
bw.appendLine("\uD83C\uDF29 Server: $serverInfo")
bw.appendLine("Fingerprint: ${Build.FINGERPRINT}")
}
}
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.


🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-29673
📔 Objective
Added more info to the header of the FlightRecorder logs, making it more similar to the info displayed on the About's copy version.
Moved
BuildInfoManagerExtensions.ktfrom UI to Core