This is an alpha release that includes experimental functionality for the new logs API in Sentry. Support for these methods are only avaliable in the browser and core SDKs.
- feat(logs): Add experimental user-callable logging methods (#15442)
Logging is gated by an experimental option, _experiments.enableLogs
.
Sentry.init({
_experiments: {
enableLogs: true,
},
});
These API are exposed in the Sentry._experiment_log
namespace.
On the high level, there are functions for each of the logging severity levels critical
, fatal
, error
, warn
, info
, debug
, trace
. These functions are tagged template functions, so they use a special string template syntax that we use to parameterize functions accordingly.
Sentry._experiment_log.info`user ${username} just bought ${item}!`;
If you want more custom usage, we also expose a captureLog
method that allows you to pass custom attributes, but it's less easy to use than the tagged template functions.
Sentry._experiment_log.captureLog('error', 'Hello world!', { 'user.id': 123 });
Bundle size 📦
Path | Size |
---|---|
@sentry/browser | 23.64 KB |
@sentry/browser - with treeshaking flags | 23.47 KB |
@sentry/browser (incl. Tracing) | 36.67 KB |
@sentry/browser (incl. Tracing, Replay) | 73.83 KB |
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags | 67.27 KB |
@sentry/browser (incl. Tracing, Replay with Canvas) | 78.47 KB |
@sentry/browser (incl. Tracing, Replay, Feedback) | 91.04 KB |
@sentry/browser (incl. Feedback) | 40.79 KB |
@sentry/browser (incl. sendFeedback) | 28.27 KB |
@sentry/browser (incl. FeedbackAsync) | 33.07 KB |
@sentry/react | 25.47 KB |
@sentry/react (incl. Tracing) | 38.61 KB |
@sentry/vue | 27.88 KB |
@sentry/vue (incl. Tracing) | 38.38 KB |
@sentry/svelte | 23.68 KB |
CDN Bundle | 24.78 KB |
CDN Bundle (incl. Tracing) | 36.68 KB |
CDN Bundle (incl. Tracing, Replay) | 71.68 KB |
CDN Bundle (incl. Tracing, Replay, Feedback) | 76.88 KB |
CDN Bundle - uncompressed | 72.38 KB |
CDN Bundle (incl. Tracing) - uncompressed | 108.76 KB |
CDN Bundle (incl. Tracing, Replay) - uncompressed | 220.01 KB |
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed | 232.59 KB |
@sentry/nextjs (client) | 39.78 KB |
@sentry/sveltekit (client) | 37.1 KB |
@sentry/node | 142.72 KB |
@sentry/node - without tracing | 96.14 KB |
@sentry/aws-serverless | 120.47 KB |