Manages crash logging for release builds. More...
#include <crash_handler.h>
Static Public Member Functions | |
| static void | Initialize (const std::string &version) |
| Initialize the crash handler for the application. | |
| static std::filesystem::path | GetCrashLogDirectory () |
| Get the path where crash logs are stored. | |
| static std::filesystem::path | GetMostRecentCrashLog () |
| Get the path to the most recent crash log, if any. | |
| static bool | HasUnacknowledgedCrashLog () |
| Check if there's a crash log from a previous session. | |
| static void | AcknowledgeCrashLog () |
| Mark the current crash log as acknowledged. | |
| static void | CleanupOldLogs (int keep_count=5) |
| Clean up old crash logs, keeping only the most recent N logs. | |
Static Private Member Functions | |
| static void | CrashLogWriter (const char *data) |
Static Private Attributes | |
| static std::string | version_ |
| static std::filesystem::path | crash_log_path_ |
| static int | crash_log_fd_ = -1 |
Manages crash logging for release builds.
This class sets up signal handlers to capture crashes and write detailed crash reports to a log file in the user's data directory. The crash report includes:
Usage: CrashHandler::Initialize("0.3.3");
Crash logs are written to:
Definition at line 30 of file crash_handler.h.
|
static |
Initialize the crash handler for the application.
| version | The application version string. |
This should be called early in main() after initializing the symbolizer. In debug builds, this may be less aggressive to allow debugging.
Definition at line 73 of file crash_handler.cc.
References crash_log_fd_, crash_log_path_, CrashLogWriter(), GetCrashLogDirectory(), and version_.
Referenced by main().

|
static |
Get the path where crash logs are stored.
Definition at line 138 of file crash_handler.cc.
References yaze::util::PlatformPaths::GetAppDataSubdirectory(), and yaze::util::PlatformPaths::GetTempDirectory().
Referenced by AcknowledgeCrashLog(), CleanupOldLogs(), GetMostRecentCrashLog(), HasUnacknowledgedCrashLog(), and Initialize().

|
static |
Get the path to the most recent crash log, if any.
Definition at line 154 of file crash_handler.cc.
References GetCrashLogDirectory().
Referenced by HasUnacknowledgedCrashLog().

|
static |
Check if there's a crash log from a previous session.
Definition at line 183 of file crash_handler.cc.
References GetCrashLogDirectory(), and GetMostRecentCrashLog().

|
static |
Mark the current crash log as acknowledged.
Call this after showing the user the crash report dialog.
Definition at line 202 of file crash_handler.cc.
References GetCrashLogDirectory().

|
static |
Clean up old crash logs, keeping only the most recent N logs.
| keep_count | Number of recent logs to keep (default: 5). |
Definition at line 211 of file crash_handler.cc.
References GetCrashLogDirectory().
Referenced by main().

|
staticprivate |
Definition at line 42 of file crash_handler.cc.
References crash_log_fd_.
Referenced by Initialize().
|
staticprivate |
Definition at line 73 of file crash_handler.h.
Referenced by Initialize().
|
staticprivate |
Definition at line 74 of file crash_handler.h.
Referenced by Initialize().
|
staticprivate |
Definition at line 75 of file crash_handler.h.
Referenced by CrashLogWriter(), and Initialize().