feat(deno): Export logs API from Deno SDK#19313
Conversation
Codecov Results 📊✅ Patch coverage is 100.00%. Project has 14 uncovered lines. Files with missing lines (2)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 61.39% 83.13% +21.74%
==========================================
Files 789 2 -787
Lines 43246 83 -43163
Branches 8353 57 -8296
==========================================
+ Hits 26558 69 -26489
- Misses 16688 14 -16674
- Partials 83 8 -75Generated by Codecov Action |
chargome
left a comment
There was a problem hiding this comment.
One thing we will need to adapt is the flushing logic for logs for server exits. The node equivalent is process.on('beforeExit') in the node-core package
There was a problem hiding this comment.
m: Please export the according Log and LogSeverityLevel types here too
| /** @inheritDoc */ | ||
| // @ts-expect-error - PromiseLike is a subset of Promise | ||
| public async close(timeout?: number | undefined): PromiseLike<boolean> { | ||
| if (this._logOnExitFlushListener) { |
There was a problem hiding this comment.
q: Couldn't we just flush in here? 🤔
There was a problem hiding this comment.
the clanker was basing the implementation on the node-core implementation where he said
The same pattern exists in packages/node-core/src/sdk/client.ts — its close() also only removes the beforeExit listener without flushing.
should we update?
There was a problem hiding this comment.
Your call, both are fine for me!
There was a problem hiding this comment.
I think the cleanest fix is to add _INTERNAL_flushLogsBuffer(this) to the base Client.close() in packages/core so all SDKs (node-core, deno, bun, cloudflare) benefit. Tracking in a separate issue so we can merge this as-is.
Re-export `logger` and `consoleLoggingIntegration` from `@sentry/core` so Deno users can use `Sentry.logger.info(...)` and capture console calls as Sentry logs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Export `Log` and `LogSeverityLevel` types from the Deno SDK. Add log
buffer flushing on server exit via `globalThis.addEventListener('unload')`
(Deno's equivalent of Node's `process.on('beforeExit')`), matching the
pattern in node-core's NodeClient. Also adds `server.address` attribute
to logs via `beforeCaptureLog` hook.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
322b135 to
56f6dfe
Compare
Summary
loggerandconsoleLoggingIntegrationfrom@sentry/corein the Deno SDKlogger.info()produces a log envelope item with correctlevelandbodyTest plan
yarn build:dev:filter @sentry/deno— builds successfullycd packages/deno && yarn test— all 13 tests passeslint packages/deno/src/index.ts— no lint errors🤖 Generated with Claude Code
Closes #19314 (added automatically)