yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::util::CrashHandler Class Reference

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
 

Detailed Description

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:

  • Timestamp
  • Signal information
  • Stack trace (if available)
  • Application version

Usage: CrashHandler::Initialize("0.3.3");

Crash logs are written to:

  • Windows: APPDATA%/yaze/crash_logs/
  • macOS: ~/.yaze/crash_logs/
  • Linux: ~/.yaze/crash_logs/

Definition at line 30 of file crash_handler.h.

Member Function Documentation

◆ Initialize()

void yaze::util::CrashHandler::Initialize ( const std::string & version)
static

Initialize the crash handler for the application.

Parameters
versionThe 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().

Here is the call graph for this function:

◆ GetCrashLogDirectory()

std::filesystem::path yaze::util::CrashHandler::GetCrashLogDirectory ( )
static

Get the path where crash logs are stored.

Returns
The crash log directory path.

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().

Here is the call graph for this function:

◆ GetMostRecentCrashLog()

std::filesystem::path yaze::util::CrashHandler::GetMostRecentCrashLog ( )
static

Get the path to the most recent crash log, if any.

Returns
Path to the most recent crash log, or empty path if none exists.

Definition at line 154 of file crash_handler.cc.

References GetCrashLogDirectory().

Referenced by HasUnacknowledgedCrashLog().

Here is the call graph for this function:

◆ HasUnacknowledgedCrashLog()

bool yaze::util::CrashHandler::HasUnacknowledgedCrashLog ( )
static

Check if there's a crash log from a previous session.

Returns
True if a crash log exists that hasn't been acknowledged.

Definition at line 183 of file crash_handler.cc.

References GetCrashLogDirectory(), and GetMostRecentCrashLog().

Here is the call graph for this function:

◆ AcknowledgeCrashLog()

void yaze::util::CrashHandler::AcknowledgeCrashLog ( )
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().

Here is the call graph for this function:

◆ CleanupOldLogs()

void yaze::util::CrashHandler::CleanupOldLogs ( int keep_count = 5)
static

Clean up old crash logs, keeping only the most recent N logs.

Parameters
keep_countNumber of recent logs to keep (default: 5).

Definition at line 211 of file crash_handler.cc.

References GetCrashLogDirectory().

Referenced by main().

Here is the call graph for this function:

◆ CrashLogWriter()

void yaze::util::CrashHandler::CrashLogWriter ( const char * data)
staticprivate

Definition at line 42 of file crash_handler.cc.

References crash_log_fd_.

Referenced by Initialize().

Member Data Documentation

◆ version_

std::string yaze::util::CrashHandler::version_
staticprivate

Definition at line 73 of file crash_handler.h.

Referenced by Initialize().

◆ crash_log_path_

std::filesystem::path yaze::util::CrashHandler::crash_log_path_
staticprivate

Definition at line 74 of file crash_handler.h.

Referenced by Initialize().

◆ crash_log_fd_

int yaze::util::CrashHandler::crash_log_fd_ = -1
staticprivate

Definition at line 75 of file crash_handler.h.

Referenced by CrashLogWriter(), and Initialize().


The documentation for this class was generated from the following files: