CleanCocoa / CleanCocoa/CrashReporter

Integrate PLCrashReporter's text formatter for new crash logs

Open
#5 0 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue help wanted
Dominant language
Swift
Stars
137
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Modern macOS formats crash reports differently than it used to. PLCrashReporter comes with a formatter that could help provide us with readable crash logs.

The rest of the `PLCrashReporter` source is less relevant, but the formatter types can be cherry picked. For inspiration, see NetNewsWire: https://github.com/Ranchero-Software/NetNewsWire/commit/3022f78434bf7f8e57f879edf6de4e6431357a2e

```swift
guard crashReporter.hasPendingCrashReport(),
let crashData = crashReporter.loadPendingCrashReportData(),
let crashReport = try? PLCrashReport(data: crashData),
let crashLogText = PLCrashReportTextFormatter.stringValue(for: crashReport, with: PLCrashReportTextFormatiOS)
else { return }
```

This would replace the `.crash` file lookup part and extraction of the string contents:

1. [The call to send(...)](https://github.com/CleanCocoa/CrashReporter/blob/03d2ee44e33661a2feebf52e0db123a1cdb16a7b/Sources/CrashReporter/CrashReporter.swift#L130) will be affected, and
2. [`CrashInfo`](https://github.com/CleanCocoa/CrashReporter/blob/03d2ee44e33661a2feebf52e0db123a1cdb16a7b/Sources/CrashReporter/CrashReporter.swift#L271-L283) would wrap the `PLCrashReport` and expose its content string via `PLCrashReportTextFormatter`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.