Files
Library/src/LogState/State.cpp

21 lines
667 B
C++

// The Void::Log facade's one state per process. Compiled into its own small
// library rather than an inline function's static: Windows gives every DLL
// that inlines a function its own static, so a sink set in one DLL would
// never see the events of another. Every module that includes
// <Void/Log/Log.hpp> links this (it has no dependencies of its own).
#include <Void/Log/Log.hpp>
namespace Void::Log::Detail
{
State& state()
{
static State s;
return s;
}
std::vector<const SinkRegistration*>& active_registrations_tls() noexcept
{
static thread_local std::vector<const SinkRegistration*> stack;
return stack;
}
} // namespace Void::Log::Detail