New header-only modules: - Void::Hash — FNV-1a 32/64, CRC-32, DJB2, MurmurHash3-32, UDL literals - Void::Random — Xoshiro256** PRNG, uniform_int/real, coin_flip, shuffle, random_string - Void::Uuid — v4 (random), v5_lite (name-based), parse, RFC 4122 namespaces - Void::Encoding — Base64 (standard + URL-safe), Hex encode/decode - Void::Bits — popcount, bit extract/deposit, rotation, align, byteswap, masks - Void::Math — Vec2/Vec3/Vec4, Mat4 (identity, translation, scale, rotation) Testing module: move Stacktrace from INTERNAL_DEPS to OPTIONAL_DEPS. Added Detail/Color.hpp shim that delegates to Stacktrace::Color when present or provides inline ANSI fallback otherwise. All Stacktrace calls in SignalHandler, ConsoleReporter, and Runner are gated on VOID_HAS_STACKTRACE. Fix Repr.hpp reflect_struct to handle template specializations that lack std::meta::identifier_of (now guarded by has_identifier check). 33/33 tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
29 lines
458 B
C++
29 lines
458 B
C++
#include <Void/Log/Log.hpp>
|
|
#include <mutex>
|
|
#include <shared_mutex>
|
|
|
|
namespace Void::Log
|
|
{
|
|
|
|
namespace
|
|
{
|
|
Sink g_sink;
|
|
std::shared_mutex g_mutex;
|
|
} // namespace
|
|
|
|
void set_sink(Sink sink)
|
|
{
|
|
std::unique_lock lock{g_mutex};
|
|
g_sink = std::move(sink);
|
|
}
|
|
|
|
void log(Level level, std::string_view module, std::string_view message)
|
|
{
|
|
std::shared_lock lock{g_mutex};
|
|
if (g_sink) {
|
|
g_sink(level, module, message);
|
|
}
|
|
}
|
|
|
|
} // namespace Void::Log
|