diff options
Diffstat (limited to 'src/zenutil/include')
| -rw-r--r-- | src/zenutil/include/zenutil/logging.h | 24 | ||||
| -rw-r--r-- | src/zenutil/include/zenutil/sessionsclient.h | 21 |
2 files changed, 38 insertions, 7 deletions
diff --git a/src/zenutil/include/zenutil/logging.h b/src/zenutil/include/zenutil/logging.h index 6abf6a96f..94a45e46f 100644 --- a/src/zenutil/include/zenutil/logging.h +++ b/src/zenutil/include/zenutil/logging.h @@ -19,8 +19,9 @@ // namespace zen::logging { +class BacklogSink; class BroadcastSink; -} +} // namespace zen::logging namespace zen { @@ -46,4 +47,25 @@ void ShutdownLogging(); logging::SinkPtr GetFileSink(); Ref<logging::BroadcastSink> GetDefaultBroadcastSink(); +/// The default backlog sink, installed alongside the broadcast sink at +/// BeginInitializeLogging. Captures every log line until DisableLogBacklog() +/// is called. Use AttachSinkWithBacklogReplay() to add a sink that should +/// receive the backlog, or call Replay() directly on this sink for ad-hoc +/// replay into a target. May return nullptr before logging is initialized +/// or after the backlog is disabled. +Ref<logging::BacklogSink> GetLogBacklogSink(); + +/// Add a sink to the default broadcast and replay the captured backlog +/// into it before any new messages reach it. Use this for any sink that +/// should see the early-startup window — e.g. an in-proc session log +/// sink, a Sentry breadcrumb sink, an OTLP forwarder. After the backlog +/// has been disabled this is equivalent to a plain AddSink. +void AttachSinkWithBacklogReplay(logging::SinkPtr Sink); + +/// Stop capturing into the backlog and free its buffer. Idempotent. +/// Call this once the bootstrap window has closed — typically right +/// before the server enters its run loop or the CLI dispatches its +/// command. Subsequent log calls bypass the backlog cheaply. +void DisableLogBacklog(); + } // namespace zen diff --git a/src/zenutil/include/zenutil/sessionsclient.h b/src/zenutil/include/zenutil/sessionsclient.h index c144a9baa..ae2364279 100644 --- a/src/zenutil/include/zenutil/sessionsclient.h +++ b/src/zenutil/include/zenutil/sessionsclient.h @@ -24,12 +24,21 @@ class SessionsServiceClient public: struct Options { - std::string TargetUrl; // Base URL of the target zenserver (e.g. "http://localhost:8558") - std::string AppName; // Application name to register - std::string Mode; // Server mode (e.g. "Server", "Compute", "Proxy") - Oid SessionId = Oid::Zero; // Session ID to register under - Oid JobId = Oid::Zero; // Optional job ID - HttpClientSettings ClientSettings; // Optional; timeouts are overridden internally (e.g. for unix sockets) + std::string TargetUrl; // Base URL of the target zenserver (e.g. "http://localhost:8558") + std::string AppName; // Application name to register + std::string Mode; // Server mode (e.g. "Server", "Compute", "Proxy") + std::string Platform; // Client platform; empty = auto-detect via GetRuntimePlatformName() + // PID the server uses to track this client's liveness. 0 = don't + // report. Auto-filled to GetCurrentProcessId() when TargetUrl looks + // local (unix socket, localhost, 127.0.0.1); set explicitly to + // override or suppress. + uint32_t ClientPid = 0; + Oid SessionId = Oid::Zero; // Session ID to register under + Oid ParentSessionId = Oid::Zero; // Optional parent session ID + // Optional task/action identifier. Use this to associate the session with + // a specific unit of work while ParentSessionId links process/session ancestry. + Oid JobId = Oid::Zero; + HttpClientSettings ClientSettings; // Optional; timeouts are overridden internally (e.g. for unix sockets) }; /// Command sent to the background worker thread. |