Log: carry call-site source_location through to the sink

Every log line showed LoggingAdapter.hpp as its source because make_sink
called Void::Logging::Logger::log() with a defaulted source_location captured
inside the adapter, discarding the real call site.

Capture std::source_location at each Void::Log::{info,warn,...} call via an
FmtLoc wrapper (the same trick Logger uses internally), thread it through a
4-argument Sink, and forward it from make_sink to logger.log(). Sinks now
receive the originating file/line/function.

Formatted emission is routed through a single non-overloaded Detail::emit():
forwarding a (level, module, std::string, source_location) call to the public
log() would otherwise also match the variadic log() overload, deducing
source_location as a format argument and failing in FmtLoc's consteval ctor.

Sink is now a 4-arg callable; updated the bundled tests accordingly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Opus 4.8 committed 2026-06-25 02:35:42 +03:00
1 parent e4ddb0c8c4
commit 2d3f9dc319
5 files changed
+97 -49

No files matched your search

+1 -1
View File
@@ -121,7 +121,7 @@ Void::Testing::Test apply_facade_config_sets_levels()
cfg.set("log.module_levels.Fsm", "trace");
Void::Logging::apply_facade_config(cfg);
Void::Log::set_sink([](auto, auto, auto) {});
Void::Log::set_sink([](auto, auto, auto, auto) {});
Void::Testing::expect(
!Void::Log::enabled(Void::Log::Level::Info, "Other"));
Void::Testing::expect(