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 a high level, 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' });
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}!`);
Bundle size 📦
Path | Size |
---|---|
@sentry/browser | 23.72 KB |
@sentry/browser - with treeshaking flags | 23.54 KB |
@sentry/browser (incl. Tracing) | 36.74 KB |
@sentry/browser (incl. Tracing, Replay) | 73.93 KB |
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags | 67.36 KB |
@sentry/browser (incl. Tracing, Replay with Canvas) | 78.57 KB |
@sentry/browser (incl. Tracing, Replay, Feedback) | 90.47 KB |
@sentry/browser (incl. Feedback) | 40.25 KB |
@sentry/browser (incl. sendFeedback) | 28.36 KB |
@sentry/browser (incl. FeedbackAsync) | 33.13 KB |
@sentry/react | 25.54 KB |
@sentry/react (incl. Tracing) | 38.69 KB |
@sentry/vue | 27.97 KB |
@sentry/vue (incl. Tracing) | 38.47 KB |
@sentry/svelte | 23.76 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.42 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.33 KB |
@sentry/nextjs (client) | 39.85 KB |
@sentry/sveltekit (client) | 37.17 KB |
@sentry/node | 142.78 KB |
@sentry/node - without tracing | 96.21 KB |
@sentry/aws-serverless | 120.53 KB |