Sentry Structured Logging for JavaScript (Browser/Node/Bun) #15916
AbhiPrasad
started this conversation in
Features / New SDKs (Integrations) / Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Sentry is adding support for structured logs, so you can view and query your logs alongside your traces and errors—all in one place.
Note
To get early access to the Sentry logging product and to see how it works, see the announcement post.
To use the new Logging APIs to send application logs directly to Sentry, you'll have to upgrade to
9.10.0
of the JavaScript SDK or higher.Logging is gated by an experimental option,
_experiments.enableLogs
.Then you can import and use methods from the
Sentry.logger
namespace to send logs to Sentry.You can leverage structured logging via the
fmt
helper. When you usefmt
, the string template and parameters are sent separately so they can be queried independently in Sentry.With server-side SDKs like
@sentry/node
,@sentry/bun
or server-side of@sentry/nextjs
or@sentry/sveltekit
, you can do structured logging without needing thefmt
helper function.To filter logs, or update them before they are sent to Sentry, you can use the
_experiments.beforeSendLog
option.Supported SDKs:
Important
@sentry/cloudflare
and@sentry/deno
currently do not have support for logging. This will be added in a future release of the SDK.Beta Was this translation helpful? Give feedback.
All reactions