mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-01 02:13:44 +00:00
feat: logging structure improvements (#2037)
* feat: logging structure improvements tested that logs are sorted by the folder argument and that the directories are created recursively. tested that crash dumps follow the same exact name (+Crash_...name..._pid.log) so you can match the crash dump to the corresponding log file much easier * Potential fix for pull request finding 'Use parsed cloneID when constructing the log folder' Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * const --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -82,7 +82,7 @@ struct bt_ctx {
|
||||
};
|
||||
|
||||
static inline void Bt(struct backtrace_state* state) {
|
||||
std::string fileName = Diagnostics::GetOutDirectory() + "crash_" + Diagnostics::GetProcessName() + "_" + std::to_string(getpid()) + ".log";
|
||||
std::string fileName = Diagnostics::GetOutDirectory() + "Crash_" + Diagnostics::GetProcessName() + "_" + std::to_string(getpid()) + ".log";
|
||||
LOG("backtrace is enabled, crash dump located at %s", fileName.c_str());
|
||||
FILE* file = fopen(fileName.c_str(), "w+");
|
||||
if (file != nullptr) {
|
||||
@@ -98,7 +98,7 @@ static void ErrorCallback(void* data, const char* msg, int errnum) {
|
||||
fprintf(stderr, "ERROR: %s (%d)", msg, errnum);
|
||||
ctx->error = 1;
|
||||
|
||||
std::string fileName = Diagnostics::GetOutDirectory() + "crash_" + Diagnostics::GetProcessName() + "_" + std::to_string(getpid()) + ".log";
|
||||
std::string fileName = Diagnostics::GetOutDirectory() + "Crash_" + Diagnostics::GetProcessName() + "_" + std::to_string(getpid()) + ".log";
|
||||
FILE* file = fopen(fileName.c_str(), "w+");
|
||||
if (file != nullptr) {
|
||||
fprintf(file, "ERROR: %s (%d)", msg, errnum);
|
||||
@@ -126,7 +126,7 @@ void CatchUnhandled(int sig) {
|
||||
|
||||
#ifndef INCLUDE_BACKTRACE
|
||||
|
||||
std::string fileName = Diagnostics::GetOutDirectory() + "crash_" + Diagnostics::GetProcessName() + "_" + std::to_string(getpid()) + ".log";
|
||||
std::string fileName = Diagnostics::GetOutDirectory() + "Crash_" + Diagnostics::GetProcessName() + "_" + std::to_string(getpid()) + ".log";
|
||||
LOG("Encountered signal %i, creating crash dump %s", sig, fileName.c_str());
|
||||
if (Diagnostics::GetProduceMemoryDump()) {
|
||||
GenerateDump();
|
||||
|
||||
Reference in New Issue
Block a user