13#include "3rdparty/nlohmann/json.hpp"
46 virtual bool TryExecute(std::string_view section_name, std::function<
bool()> &&func) = 0;
49 std::string
CreateFileName(
const char *ext,
bool with_dir =
true)
const;
55 nlohmann::json survey;
56 std::string crashlog_filename;
57 std::string crashdump_filename;
58 std::string savegame_filename;
59 std::string screenshot_filename;
62 void PrintCrashLog()
const;
Helper class for creating crash logs.
void MakeCrashLog()
Makes the crash log, writes it to a file and then subsequently tries to make a crash dump and crash s...
bool WriteCrashLog()
Write the crash log to a file.
virtual void SurveyStacktrace(nlohmann::json &survey) const =0
Convert stacktrace to JSON.
std::string CreateFileName(const char *ext, bool with_dir=true) const
Create a timestamped filename.
static std::string message
Error message coming from FatalError(format, ...).
void SendSurvey() const
Send the survey result, noting it was a crash.
virtual bool TryExecute(std::string_view section_name, std::function< bool()> &&func)=0
Execute the func() and return its value.
virtual bool WriteCrashDump()
Write the (crash) dump to a file.
bool WriteSavegame()
Write the (crash) savegame to a file.
bool WriteScreenshot()
Write the (crash) screenshot to a file.
void FillCrashLog()
Fill the crash log buffer with all data of a crash log.
static void InitThread()
Prepare crash log handler for a newly started thread.
static void SetErrorMessage(const std::string &message)
Sets a message for the error message handler.
virtual ~CrashLog()=default
Stub destructor to silence some compilers.
virtual void SurveyCrash(nlohmann::json &survey) const =0
Convert system crash reason to JSON.
static void AfterCrashLogCleanup()
Try to close the sound/video stuff so it doesn't keep lingering around incorrect video states or so,...
static void InitialiseCrashLog()
Initialiser for crash logs; do the appropriate things so crashes are handled by our crash handler ins...