log: snapshot scopes through the shared library boundary

Avoid consumer-inline access to DLL-owned thread-local storage by copying
the scope span returned by the existing out-of-line current_scopes function.
Keep the owned snapshot at its original initializer position and preserve
filtering, scope order and exception behavior.

Add direct-call regressions for nested buffered ownership, overlapping
producer scopes and immediate sink reentry. All 14 focused shared-library
tests pass on Linux and the two-file candidate passed independent review.
Native UCRT64 linking and runtime verification follow through Engine CI.
This commit is contained in:
faumaray committed 2026-11-15 03:25:25 +03:00
1 parent 5464e9fa35
commit f1f9ba375b
2 files changed
+304 -2

No files matched your search

+6 -2
View File
@@ -398,8 +398,12 @@ namespace Void::Logging
.timestamp = std::chrono::system_clock::now(),
.location = location,
.thread_id = std::this_thread::get_id(),
.scopes = s_scope_stack, // snapshot — s_scope_stack is
// thread-local
// Snapshot here through the existing DLL function boundary.
.scopes = [] {
const auto scopes = Logger::current_scopes();
return std::vector<std::string>(
scopes.begin(), scopes.end());
}(),
.fields = {fields.begin(), fields.end()},
};