crash reporter: expected absence is silent, a real read failure is not
This commit is contained in:
parent
e595ef6d72
commit
b37b1d396a
1 changed files with 28 additions and 3 deletions
|
|
@ -76,14 +76,39 @@ Singleton {
|
|||
}
|
||||
}
|
||||
|
||||
// Set once we have successfully read the log, so a later failure is
|
||||
// distinguishable from "it has never existed".
|
||||
property bool _crashLogSeen: false
|
||||
property bool _crashLogFailureReported: false
|
||||
|
||||
FileView {
|
||||
id: crashLog
|
||||
path: root.stateDir + "/crashes.log"
|
||||
watchChanges: true
|
||||
onFileChanged: reload()
|
||||
onLoaded: root.consumeCrashLog()
|
||||
// No crashes.log yet — nothing has ever crashed. The watcher can't
|
||||
// watch a nonexistent file, so the 30s tick retries the reload.
|
||||
// watch a nonexistent file, so the 30s tick retries the reload, and
|
||||
// each retry printed a "Read of ... failed" warning. On a healthy
|
||||
// 16h session that was 1293 lines — 78% of everything in the shell
|
||||
// log, drowning the file we read to verify our own changes.
|
||||
//
|
||||
// Absence is the *expected* state here, so it is silenced. But it is
|
||||
// not silenced blind: onLoadFailed still fires, and a failure after
|
||||
// we have once read the file successfully is a real fault and says
|
||||
// so — once, not every 30 seconds.
|
||||
printErrors: false
|
||||
onFileChanged: reload()
|
||||
onLoaded: {
|
||||
root._crashLogSeen = true;
|
||||
root._crashLogFailureReported = false;
|
||||
root.consumeCrashLog();
|
||||
}
|
||||
onLoadFailed: {
|
||||
if (root._crashLogSeen && !root._crashLogFailureReported) {
|
||||
root._crashLogFailureReported = true;
|
||||
console.log("[CrashReporter] crashes.log became unreadable at",
|
||||
crashLog.path, "— crash reporting is blind until it returns");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function consumeCrashLog() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue