Skip to content

QVAC-20580 feat[api]: add subscribeServerLogs to capture all server logs#2558

Merged
arun-mani-j merged 1 commit into
tetherto:mainfrom
arun-mani-j:allLogs
Jun 17, 2026
Merged

QVAC-20580 feat[api]: add subscribeServerLogs to capture all server logs#2558
arun-mani-j merged 1 commit into
tetherto:mainfrom
arun-mani-j:allLogs

Conversation

@arun-mani-j

Copy link
Copy Markdown
Contributor

🎯 What problem does this PR solve?

  • Server-side SDK logs could only be consumed per stream ID via loggingStream({ id })SDK_LOG_ID for SDK logs, each modelId for addon logs, each workspace key for RAG. There was no single mechanism to capture all server-side logs.
  • Consumers (especially tests and integrations) had to open/manage multiple streams and know internal IDs ahead of time.
  • Config already covered global log level and console output (loggerLevel, loggerConsoleOutput); the missing piece was a unified custom handler.

📝 How does it solve it?

  • Adds subscribeServerLogs(handler) (client/api/subscribe-logs.ts): one subscription that receives every server-side log (SDK + all models + RAG + any future scope) and returns an unsubscribe(). No per-ID subscriptions, no internal IDs required.
  • Introduces a reserved stream id SDK_ALL_LOG_ID ("__all__"). On the server, sendLogToStreams(id, …) now also fans out to the __all__ stream (server/bare/registry/logging-stream-registry.ts). Because every server logger already converges on sendLogToStreams (via createStreamLogger), this captures all scopes with no per-logger wiring.
  • worker-core buffers startup logs for __all__ (mirroring existing SDK_LOG_ID buffering), so a subscriber attaching just after spawn still receives early logs.
  • Exports subscribeServerLogs, ServerLogHandler, and SDK_ALL_LOG_ID from @qvac/sdk.

🧪 How was it tested?

  • New unit test test/unit/logging-stream-global.test.ts: global stream receives logs across multiple source IDs, per-ID streams stay isolated, unsubscribe stops delivery, and buffered startup logs flush on subscribe. Full bun run test:unit passes.
  • New example examples/logging-global.ts (+ examples/config/logging/logging.config.json): one handler captures all server logs end to end; verified against a live loadModel/completion run (27 server logs captured across sdk:server and llamacpp-completion).

🔌 API Changes

import { subscribeServerLogs } from "@qvac/sdk";

// One handler for every server-side log — no per-ID loggingStream() calls.
const unsubscribe = subscribeServerLogs((log) => {
  console.log(`[${log.level}] [${log.namespace}] ${log.message}`);
});

// later
unsubscribe();

@arun-mani-j arun-mani-j requested review from a team as code owners June 12, 2026 08:55
@arun-mani-j arun-mani-j added verified Authorize secrets / label-gate in PR workflows test-e2e-smoke Triggers smoke e2e test suite [Currently SDK-only] labels Jun 12, 2026
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions github-actions Bot added the e2e-tested Test suite has run on this PR. Does not indicate tests pass/fail - see results in comments. label Jun 16, 2026
@arun-mani-j

Copy link
Copy Markdown
Contributor Author

review

@arun-mani-j arun-mani-j added test-e2e-smoke Triggers smoke e2e test suite [Currently SDK-only] and removed test-e2e-smoke Triggers smoke e2e test suite [Currently SDK-only] e2e-tested Test suite has run on this PR. Does not indicate tests pass/fail - see results in comments. labels Jun 17, 2026
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

QVAC E2E — android⚠️ no results

Config: suite=smoke · filter=(none) · exclude=(none)
View run · Artifacts: reports · Device Farm logs

The test job did not produce a results artifact. Check the run for job-level failures.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

QVAC E2E — windows⚠️ no results

Config: suite=smoke · filter=(none) · exclude=(none)
View run

The test job did not produce a results artifact. Check the run for job-level failures.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

QVAC E2E — linux⚠️ no results

Config: suite=smoke · filter=(none) · exclude=(none)
View run

The test job did not produce a results artifact. Check the run for job-level failures.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

QVAC E2E — macos⚠️ no results

Config: suite=smoke · filter=(none) · exclude=(none)
View run

The test job did not produce a results artifact. Check the run for job-level failures.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

QVAC E2E — ios⚠️ no results

Config: suite=smoke · filter=(none) · exclude=(none)
View run · Artifacts: reports · Device Farm logs

The test job did not produce a results artifact. Check the run for job-level failures.

… logs

Signed-off-by: Arun Mani J <j.arunmani@proton.me>
@arun-mani-j

Copy link
Copy Markdown
Contributor Author

review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test-e2e-smoke Triggers smoke e2e test suite [Currently SDK-only] verified Authorize secrets / label-gate in PR workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants