Void::Log::Detail::state() was a static in an inline function, which is one object per DLL on Windows: a sink set from one DLL never saw events from another (a plugin's log lines, or any module but the one that set it). The state now lives in Void::LogState, a small compiled module with no dependencies, linked by every module that includes the facade (Async, System, Stacktrace, Testing; the rest through them), so INTERFACE modules can still log and no dependency cycle appears. Tests: VoidTests 1242 pass, 3 skip; run_with_args_builds_correct_argv and run_stdin_forwarded_to_cat fail on NixOS, which has no /bin/echo or /bin/cat (exit 127). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
20893d1bf3
commit
cd237207d4
7 files changed
+30
-12
No files matched your search
@@ -13,10 +13,11 @@
|
||||
#include <utility>
|
||||
|
||||
// ── Void::Log — the emission facade
|
||||
// ─────────────────────────────────────────── Header-only so every module
|
||||
// (including INTERFACE libraries) can log with zero link dependencies. The full
|
||||
// sink framework lives in Void::Logging (Logger.hpp); bridge with
|
||||
// Void/Log/LoggingAdapter.hpp.
|
||||
// ─────────────────────────────────────────── Header-only apart from its
|
||||
// state, which Void::LogState (a small library with no dependencies) holds
|
||||
// once per process, so every module (including INTERFACE libraries) can log by
|
||||
// linking only that. The full sink framework lives in Void::Logging
|
||||
// (Logger.hpp); bridge with Void/Log/LoggingAdapter.hpp.
|
||||
//
|
||||
// Integration contract:
|
||||
// * No sink installed (the default) — every call is a single relaxed
|
||||
@@ -85,11 +86,9 @@ namespace Void::Log
|
||||
std::shared_mutex mutex;
|
||||
};
|
||||
|
||||
inline State& state()
|
||||
{
|
||||
static State s;
|
||||
return s;
|
||||
}
|
||||
// The process's one State, defined in Void::LogState (a static in an
|
||||
// inline function would be one per DLL on Windows).
|
||||
State& state();
|
||||
} // namespace Detail
|
||||
|
||||
/// Install the global sink. Any previously installed sink is replaced.
|
||||
|
||||
Reference in new issue
Block a user