aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/sentryintegration.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2026-03-23 12:53:58 +0100
committerGitHub Enterprise <[email protected]>2026-03-23 12:53:58 +0100
commite12feda1272922f6ad3567dd27509f0ec53d3a7b (patch)
tree8d238687c643a6790f9f307db3008a0e400caf42 /src/zencore/sentryintegration.cpp
parentDocumentation updates (#882) (diff)
downloadzen-e12feda1272922f6ad3567dd27509f0ec53d3a7b.tar.xz
zen-e12feda1272922f6ad3567dd27509f0ec53d3a7b.zip
Logger simplification (#883)
- **`Logger` now holds a single `SinkPtr`** instead of a `std::vector<SinkPtr>`. The `SetSinks`/`AddSink` API is replaced with a single `SetSink`. This removes complexity from `Logger` itself and makes `Clone()` cheaper (no vector copy). - **New `BroadcastSink`** (`zencore/logging/broadcastsink.h`) acts as a thread-safe, shared indirection point that fans out to a dynamic list of child sinks. Adding or removing a child sink via `AddSink`/`RemoveSink` is immediately visible to every `Logger` that holds a reference to it — including cloned loggers — without requiring each logger to be updated individually. - **`GetDefaultBroadcastSink()`** (exposed from `zenutil/logging.h`) gives server-layer code access to the shared broadcast sink so it can register optional sinks (OTel, TCP log stream) after logging is initialized, without going through `Default()->AddSink()`. ### Motivation Previously, dynamically adding sinks post-initialization mutated the default logger's internal sink vector directly. This was fragile: cloned loggers (created before `AddSink` was called) would not pick up the new sinks. `BroadcastSink` fixes this by making the sink list a shared, mutable object that all loggers sharing the same broadcast instance observe uniformly.
Diffstat (limited to 'src/zencore/sentryintegration.cpp')
-rw-r--r--src/zencore/sentryintegration.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/zencore/sentryintegration.cpp b/src/zencore/sentryintegration.cpp
index c9c843dd6..8491bef64 100644
--- a/src/zencore/sentryintegration.cpp
+++ b/src/zencore/sentryintegration.cpp
@@ -341,7 +341,7 @@ SentryIntegration::Initialize(const Config& Conf, const std::string& CommandLine
sentry_set_user(SentryUserObject);
logging::SinkPtr SentrySink(new sentry::SentrySink());
- m_SentryLogger = Ref<logging::Logger>(new logging::Logger("sentry", std::vector<logging::SinkPtr>{SentrySink}));
+ m_SentryLogger = Ref<logging::Logger>(new logging::Logger("sentry", SentrySink));
logging::Registry::Instance().Register(m_SentryLogger);
logging::SetErrorLog("sentry");