[Logging] Add stack trace in code paths that shouldn't occur (#2453)

* [Logging] Add stack trace in code paths that shouldn't occur

* Update zone_store.cpp

* Windows workaround
This commit is contained in:
Chris Miles
2022-09-28 13:32:39 -05:00
committed by GitHub
parent f8e7576ae7
commit f357361474
6 changed files with 4496 additions and 5 deletions
+1
View File
@@ -650,6 +650,7 @@ SET(common_headers
patches/uf_limits.h
patches/uf_ops.h
patches/uf_structs.h
stacktrace/backward.hpp
StackWalker/StackWalker.h
util/memory_stream.h
util/directory.h
File diff suppressed because it is too large Load Diff
+12 -1
View File
@@ -20,6 +20,7 @@
#include "zone_store.h"
#include "../common/content/world_content_service.h"
#include "stacktrace/backward.hpp"
ZoneStore::ZoneStore() = default;
ZoneStore::~ZoneStore() = default;
@@ -82,11 +83,21 @@ const char *ZoneStore::GetZoneName(uint32 zone_id, bool error_unknown)
}
LogInfo(
"[GetZoneName] Failed to get zone name by zone_id [{}] error_unknown [{}]",
"[GetZoneName] Failed to get zone name by zone_id [{}] error_unknown [{}] printing stack",
zone_id,
(error_unknown ? "true" : "false")
);
// print stack when invalid input
if (zone_id == 0) {
backward::StackTrace st;
backward::TraceResolver e = {};
st.load_here(32);
backward::Printer p;
p.print(st);
}
return nullptr;
}