[CrashReporting] Give crash-report logging its own category per review

This commit is contained in:
Lukas Brübach 2026-10-18 13:10:37 +02:00 • committed by GitHub
parent 4d790ff388
commit 9ced9b61ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 2 deletions

View file

@ -6,10 +6,13 @@
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
#include <QLoggingCategory>
#include <QRegularExpression> #include <QRegularExpression>
#include <QUrl> #include <QUrl>
#include <libcockatrice/settings/personal_settings.h> #include <libcockatrice/settings/personal_settings.h>
Q_LOGGING_CATEGORY(CrashReportLog, "crash_report");
bool CrashReporter::isReportingEnabled(const QString &dsn, PersonalSettings::CrashReportingMode consentMode) bool CrashReporter::isReportingEnabled(const QString &dsn, PersonalSettings::CrashReportingMode consentMode)
{ {
return !dsn.isEmpty() && consentMode != PersonalSettings::CrashReportingMode::NeverSend; return !dsn.isEmpty() && consentMode != PersonalSettings::CrashReportingMode::NeverSend;

View file

@ -6,6 +6,7 @@
#ifndef CRASH_REPORTER_H #ifndef CRASH_REPORTER_H
#define CRASH_REPORTER_H #define CRASH_REPORTER_H
#include <QLoggingCategory>
#include <QString> #include <QString>
#include <libcockatrice/settings/personal_settings.h> #include <libcockatrice/settings/personal_settings.h>
@ -17,6 +18,8 @@
#define COCKATRICE_SENTRY_DSN "" #define COCKATRICE_SENTRY_DSN ""
#endif #endif
Q_DECLARE_LOGGING_CATEGORY(CrashReportLog);
/** /**
* @brief Sentry-backed crash-report facade, owned by main(). * @brief Sentry-backed crash-report facade, owned by main().
* *

View file

@ -136,9 +136,9 @@ void DlgCrashReport::actSend()
} }
const QString savedPath = writeMockReport(previewArea->toPlainText()); const QString savedPath = writeMockReport(previewArea->toPlainText());
if (savedPath.isEmpty()) { if (savedPath.isEmpty()) {
qWarning() << "Could not save the mock crash report locally"; qCWarning(CrashReportLog) << "Could not save the mock crash report locally";
} else { } else {
qInfo() << "Mock crash report saved locally to" << savedPath; qCInfo(CrashReportLog) << "Mock crash report saved locally to" << savedPath;
} }
accept(); accept();
} }