github getsentry/sentry-javascript 9.6.0-alpha.0

pre-release3 hours ago

This is an alpha release that includes experimental functionality for the new logs API in Sentry. All experimental features are subject to breaking changes.

  • feat(logs): Add experimental user-callable logging methods (#15442)

Logging is gated by an experimental option, _experiments.enableLogs.

Sentry.init({
  _experiments: {
    // Enable logs to be sent to Sentry.
    enableLogs: true,
  },
});

These API are exposed in the Sentry._experiment_log namespace. In the future the _experiment_log namespace will be removed and logging functions will be moved into a more stable namespace.

There are functions for each of the logging severity levels fatal, error, warn, info, debug, trace. There is also a log function that is an alias to info.

Sentry._experiment_log.info('Adding item to cart', { item: 'sneakers' });

Sentry._experiment_log.warn('User performed invalid operation', { userId: '23423874', operation: 'open-file' });

If you want to do structured logging, you'll need to use the fmt helper exposed in the Sentry._experiment_log namespace.

const { fmt } = Sentry._experiment_log;

Sentry._experiment_log.info(fmt`user ${username} just bought ${item}!`);

SDKs that support the Alpha Logging APIs:

  • @sentry/astro
  • @sentry/aws-serverless
  • @sentry/browser
  • @sentry/bun
  • @sentry/cloudflare
  • @sentry/core
  • @sentry/deno
  • @sentry/ember
  • @sentry/gatsby
  • @sentry/google-cloud-serverless
  • @sentry/nestjs
  • @sentry/nextjs
  • @sentry/node
  • @sentry/nuxt
  • @sentry/react
  • @sentry/remix
  • @sentry/solid
  • @sentry/solidstart
  • @sentry/svelte
  • @sentry/sveltekit
  • @sentry/vercel-edge
  • @sentry/vue

Bundle size 📦

Path Size
@sentry/browser 23.82 KB
@sentry/browser - with treeshaking flags 23.63 KB
@sentry/browser (incl. Tracing) 36.82 KB
@sentry/browser (incl. Tracing, Replay) 73.98 KB
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 67.42 KB
@sentry/browser (incl. Tracing, Replay with Canvas) 78.63 KB
@sentry/browser (incl. Tracing, Replay, Feedback) 91.17 KB
@sentry/browser (incl. Feedback) 40.97 KB
@sentry/browser (incl. sendFeedback) 28.46 KB
@sentry/browser (incl. FeedbackAsync) 33.24 KB
@sentry/react 25.61 KB
@sentry/react (incl. Tracing) 38.72 KB
@sentry/vue 28.03 KB
@sentry/vue (incl. Tracing) 38.54 KB
@sentry/svelte 23.85 KB
CDN Bundle 24.36 KB
CDN Bundle (incl. Tracing) 36.25 KB
CDN Bundle (incl. Tracing, Replay) 71.27 KB
CDN Bundle (incl. Tracing, Replay, Feedback) 76.44 KB
CDN Bundle - uncompressed 71.15 KB
CDN Bundle (incl. Tracing) - uncompressed 107.53 KB
CDN Bundle (incl. Tracing, Replay) - uncompressed 218.8 KB
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 231.36 KB
@sentry/nextjs (client) 39.87 KB
@sentry/sveltekit (client) 37.24 KB
@sentry/node 142.83 KB
@sentry/node - without tracing 96.26 KB
@sentry/aws-serverless 120.59 KB

Don't miss a new sentry-javascript release

NewReleases is sending notifications on new releases.