MCPcopy Create free account
hub / github.com/DFHack/dfhack / get_crashlog_path

Function get_crashlog_path

library/Crashlog.cpp:92–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92std::filesystem::path get_crashlog_path() {
93 std::time_t time = std::time(nullptr);
94 std::tm* tm = std::localtime(&time);
95
96 std::string timestamp = "unknown";
97 if (tm) {
98 char stamp[64];
99 std::size_t out = strftime(&stamp[0], 63, "%Y-%m-%d-%H-%M-%S", tm);
100 if (out != 0)
101 timestamp = stamp;
102 }
103
104 std::filesystem::path dir = "crashlog";
105 std::error_code err;
106 std::filesystem::create_directories(dir, err);
107
108 std::filesystem::path log_path = dir / ("crash_" + timestamp + ".txt");
109 return log_path;
110}
111
112void dfhack_save_crashlog() {
113 char** backtrace_strings = backtrace_symbols(crash_info.backtrace, crash_info.backtrace_entries);

Callers 1

dfhack_save_crashlogFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected