diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2023-04-21 16:48:30 +0100 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2023-04-21 16:48:36 +0100 |
| commit | 7b5b4a1049812733bf3be2d2191ab90f0e1a2459 (patch) | |
| tree | a102e9684521205cc19c6f749c9f64ff59602687 /src/debug/CrashReporter.cpp | |
| parent | 458ea56b86fbfdd02c584a1cfd3f3eac2287eed7 (diff) | |
crashReporter: log on crash
Diffstat (limited to 'src/debug/CrashReporter.cpp')
| -rw-r--r-- | src/debug/CrashReporter.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/debug/CrashReporter.cpp b/src/debug/CrashReporter.cpp index 4d6a3c53..5d803458 100644 --- a/src/debug/CrashReporter.cpp +++ b/src/debug/CrashReporter.cpp @@ -135,13 +135,15 @@ void CrashReporter::createAndSaveCrash(int sig) { return; std::ofstream ofs; + std::string path; if (!CACHE_HOME) { if (!std::filesystem::exists(std::string(HOME) + "/.hyprland")) { std::filesystem::create_directory(std::string(HOME) + "/.hyprland"); std::filesystem::permissions(std::string(HOME) + "/.hyprland", std::filesystem::perms::all, std::filesystem::perm_options::replace); } - ofs.open(std::string(HOME) + "/.hyprland/hyprlandCrashReport" + std::to_string(PID) + ".txt", std::ios::trunc); + path = std::string(HOME) + "/.hyprland/hyprlandCrashReport" + std::to_string(PID) + ".txt"; + ofs.open(path, std::ios::trunc); } else if (CACHE_HOME) { if (!std::filesystem::exists(std::string(CACHE_HOME) + "/hyprland")) { @@ -149,7 +151,8 @@ void CrashReporter::createAndSaveCrash(int sig) { std::filesystem::permissions(std::string(CACHE_HOME) + "/hyprland", std::filesystem::perms::all, std::filesystem::perm_options::replace); } - ofs.open(std::string(CACHE_HOME) + "/hyprland/hyprlandCrashReport" + std::to_string(PID) + ".txt", std::ios::trunc); + path = std::string(CACHE_HOME) + "/hyprland/hyprlandCrashReport" + std::to_string(PID) + ".txt"; + ofs.open(path, std::ios::trunc); } else { return; } @@ -157,4 +160,7 @@ void CrashReporter::createAndSaveCrash(int sig) { ofs << finalCrashReport; ofs.close(); + + Debug::disableStdout = false; + Debug::log(CRIT, "Hyprland has crashed :( Consult the crash report at %s for more information.", path.c_str()); } |
