From 296571521ee1c8c59b26a283f75da68111602c1b Mon Sep 17 00:00:00 2001 From: Sergiy Dybskiy Date: Mon, 8 Dec 2025 11:35:52 -0500 Subject: [PATCH 1/3] neat(logs) prefer to use Sentry.logger over const { logger } --- .../llm-rules-platform/_default.mdx | 24 +++++++++---------- .../llm-rules-platform/javascript.nextjs.mdx | 6 ++--- .../llm-rules-platform/javascript.node.mdx | 6 ++--- .../llm-rules-platform/javascript.react.mdx | 6 ++--- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/platform-includes/llm-rules-platform/_default.mdx b/platform-includes/llm-rules-platform/_default.mdx index ef86d099d2edf..7549e84000d38 100644 --- a/platform-includes/llm-rules-platform/_default.mdx +++ b/platform-includes/llm-rules-platform/_default.mdx @@ -2,8 +2,8 @@ Sentry provides a set of rules you can use to help your LLM use Sentry correctly. Copy this file and add it to your projects rules configuration. When created as a rules file this should be placed alongside other editor specific rule files. For example, if you are using Cursor, place this file in the `.cursor/rules` directory, or the contents in the `AGENTS.md` or `.cursorrules` (legacy) files. -{/* ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/javascript/javascript.tsx). -If you make any changes, please update the getting started doc accordingly. */} +{/_ ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/javascript/javascript.tsx). +If you make any changes, please update the getting started doc accordingly. _/} ````markdown {filename:rules.mdc} These examples should be used as guidance when configuring Sentry functionality within a project. @@ -79,7 +79,7 @@ async function fetchUserData(userId) { - Where logs are used, ensure Sentry is imported using `import * as Sentry from "@sentry/browser"` - Enable logging in Sentry using `Sentry.init({ enableLogs: true })` -- Reference the logger using `const { logger } = Sentry` +- Reference the logger using `Sentry.logger` - Sentry offers a `consoleLoggingIntegration` that can be used to log specific console error types automatically without instrumenting the individual logger calls ## Configuration @@ -110,25 +110,23 @@ Sentry.init({ ## Logger Examples -`logger.fmt` is a template literal function that should be used to bring variables into the structured logs. +`Sentry.logger.fmt` is a template literal function that should be used to bring variables into the structured logs. ```javascript -import * as Sentry from "@sentry/browser"; - -const { logger } = Sentry; +import * as Sentry from "@sentry/nextjs"; -logger.trace("Starting database connection", { database: "users" }); -logger.debug(logger.fmt`Cache miss for user: ${userId}`); -logger.info("Updated profile", { profileId: 345 }); -logger.warn("Rate limit reached for endpoint", { +Sentry.logger.trace("Starting database connection", { database: "users" }); +Sentry.logger.debug(Sentry.logger.fmt`Cache miss for user: ${userId}`); +Sentry.logger.info("Updated profile", { profileId: 345 }); +Sentry.logger.warn("Rate limit reached for endpoint", { endpoint: "/api/results/", isEnterprise: false, }); -logger.error("Failed to process payment", { +Sentry.logger.error("Failed to process payment", { orderId: "order_123", amount: 99.99, }); -logger.fatal("Database connection pool exhausted", { +Sentry.logger.fatal("Database connection pool exhausted", { database: "users", activeConnections: 100, }); diff --git a/platform-includes/llm-rules-platform/javascript.nextjs.mdx b/platform-includes/llm-rules-platform/javascript.nextjs.mdx index 1eef9d42048bb..402915f311a93 100644 --- a/platform-includes/llm-rules-platform/javascript.nextjs.mdx +++ b/platform-includes/llm-rules-platform/javascript.nextjs.mdx @@ -2,8 +2,8 @@ Sentry provides a set of rules you can use to help your LLM use Sentry correctly. Copy this file and add it to your projects rules configuration. When created as a rules file this should be placed alongside other editor specific rule files. For example, if you are using Cursor, place this file in the `.cursor/rules` directory, or the contents in the `AGENTS.md` or `.cursorrules` (legacy) files. -{/* ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/javascript/nextjs.tsx). -If you make any changes, please update the getting started doc accordingly. */} +{/_ ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/javascript/nextjs.tsx). +If you make any changes, please update the getting started doc accordingly. _/} ````markdown {filename:rules.mdc} These examples should be used as guidance when configuring Sentry functionality within a project. @@ -79,7 +79,7 @@ async function fetchUserData(userId) { - Where logs are used, ensure Sentry is imported using `import * as Sentry from "@sentry/nextjs"` - Enable logging in Sentry using `Sentry.init({ enableLogs: true })` -- Reference the logger using `const { logger } = Sentry` +- Reference the logger using `Sentry.logger` - Sentry offers a consoleLoggingIntegration that can be used to log specific console error types automatically without instrumenting the individual logger calls ## Configuration diff --git a/platform-includes/llm-rules-platform/javascript.node.mdx b/platform-includes/llm-rules-platform/javascript.node.mdx index 0b580f8bb73e1..156c7d11bcc34 100644 --- a/platform-includes/llm-rules-platform/javascript.node.mdx +++ b/platform-includes/llm-rules-platform/javascript.node.mdx @@ -2,8 +2,8 @@ Sentry provides a set of rules you can use to help your LLM use Sentry correctly. Copy this file and add it to your projects rules configuration. When created as a rules file this should be placed alongside other editor specific rule files. For example, if you are using Cursor, place this file in the `.cursor/rules` directory, or the contents in the `AGENTS.md` or `.cursorrules` (legacy) files. -{/* ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/node/node.tsx). -If you make any changes, please update the getting started doc accordingly. */} +{/_ ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/node/node.tsx). +If you make any changes, please update the getting started doc accordingly. _/} ````markdown {filename:rules.mdc} These examples should be used as guidance when configuring Sentry functionality within a project. @@ -74,7 +74,7 @@ async function fetchUserData(userId) { - Where logs are used, ensure they are imported using `import * as Sentry from "@sentry/node"` - Enable logging in Sentry using `Sentry.init({ enableLogs: true, })` -- Reference the logger using `const { logger } = Sentry` +- Reference the logger using `Sentry.logger` - Sentry offers a consoleLoggingIntegration that can be used to log specific console error types automatically without instrumenting the individual logger calls ## Configuration diff --git a/platform-includes/llm-rules-platform/javascript.react.mdx b/platform-includes/llm-rules-platform/javascript.react.mdx index 9b6187ebbae6a..aec8f8cd06fce 100644 --- a/platform-includes/llm-rules-platform/javascript.react.mdx +++ b/platform-includes/llm-rules-platform/javascript.react.mdx @@ -2,8 +2,8 @@ Sentry provides a set of rules you can use to help your LLM use Sentry correctly. Copy this file and add it to your projects rules configuration. When created as a rules file this should be placed alongside other editor specific rule files. For example, if you are using Cursor, place this file in the `.cursor/rules` directory, or the contents in the `AGENTS.md` or `.cursorrules` (legacy) files. -{/* ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/javascript/react.tsx). -If you make any changes, please update the getting started doc accordingly. */} +{/_ ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/javascript/react.tsx). +If you make any changes, please update the getting started doc accordingly. _/} ````markdown {filename:rules.mdc} These examples should be used as guidance when configuring Sentry functionality within a project. @@ -74,7 +74,7 @@ async function fetchUserData(userId) { - Where logs are used, ensure Sentry is imported using `import * as Sentry from "@sentry/react"` - Enable logging in Sentry using `Sentry.init({ enableLogs: true })` -- Reference the logger using `const { logger } = Sentry` +- Reference the logger using `Sentry.logger` - Sentry offers a consoleLoggingIntegration that can be used to log specific console error types automatically without instrumenting the individual logger calls ## Configuration From d150e0078f8f21056ce5762ec94c75af511262ea Mon Sep 17 00:00:00 2001 From: Sergiy Dybskiy Date: Mon, 8 Dec 2025 11:37:57 -0500 Subject: [PATCH 2/3] comments --- platform-includes/llm-rules-platform/_default.mdx | 4 ++-- platform-includes/llm-rules-platform/javascript.nextjs.mdx | 4 ++-- platform-includes/llm-rules-platform/javascript.node.mdx | 4 ++-- platform-includes/llm-rules-platform/javascript.react.mdx | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platform-includes/llm-rules-platform/_default.mdx b/platform-includes/llm-rules-platform/_default.mdx index 7549e84000d38..34d0b648e726e 100644 --- a/platform-includes/llm-rules-platform/_default.mdx +++ b/platform-includes/llm-rules-platform/_default.mdx @@ -2,8 +2,8 @@ Sentry provides a set of rules you can use to help your LLM use Sentry correctly. Copy this file and add it to your projects rules configuration. When created as a rules file this should be placed alongside other editor specific rule files. For example, if you are using Cursor, place this file in the `.cursor/rules` directory, or the contents in the `AGENTS.md` or `.cursorrules` (legacy) files. -{/_ ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/javascript/javascript.tsx). -If you make any changes, please update the getting started doc accordingly. _/} +{/* ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/javascript/javascript.tsx). +If you make any changes, please update the getting started doc accordingly. */} ````markdown {filename:rules.mdc} These examples should be used as guidance when configuring Sentry functionality within a project. diff --git a/platform-includes/llm-rules-platform/javascript.nextjs.mdx b/platform-includes/llm-rules-platform/javascript.nextjs.mdx index 402915f311a93..e736df744a870 100644 --- a/platform-includes/llm-rules-platform/javascript.nextjs.mdx +++ b/platform-includes/llm-rules-platform/javascript.nextjs.mdx @@ -2,8 +2,8 @@ Sentry provides a set of rules you can use to help your LLM use Sentry correctly. Copy this file and add it to your projects rules configuration. When created as a rules file this should be placed alongside other editor specific rule files. For example, if you are using Cursor, place this file in the `.cursor/rules` directory, or the contents in the `AGENTS.md` or `.cursorrules` (legacy) files. -{/_ ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/javascript/nextjs.tsx). -If you make any changes, please update the getting started doc accordingly. _/} +{/* ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/javascript/nextjs.tsx). +If you make any changes, please update the getting started doc accordingly. */} ````markdown {filename:rules.mdc} These examples should be used as guidance when configuring Sentry functionality within a project. diff --git a/platform-includes/llm-rules-platform/javascript.node.mdx b/platform-includes/llm-rules-platform/javascript.node.mdx index 156c7d11bcc34..2063cd998d732 100644 --- a/platform-includes/llm-rules-platform/javascript.node.mdx +++ b/platform-includes/llm-rules-platform/javascript.node.mdx @@ -2,8 +2,8 @@ Sentry provides a set of rules you can use to help your LLM use Sentry correctly. Copy this file and add it to your projects rules configuration. When created as a rules file this should be placed alongside other editor specific rule files. For example, if you are using Cursor, place this file in the `.cursor/rules` directory, or the contents in the `AGENTS.md` or `.cursorrules` (legacy) files. -{/_ ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/node/node.tsx). -If you make any changes, please update the getting started doc accordingly. _/} +{/* ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/node/node.tsx). +If you make any changes, please update the getting started doc accordingly. */} ````markdown {filename:rules.mdc} These examples should be used as guidance when configuring Sentry functionality within a project. diff --git a/platform-includes/llm-rules-platform/javascript.react.mdx b/platform-includes/llm-rules-platform/javascript.react.mdx index aec8f8cd06fce..52f99bb05b44a 100644 --- a/platform-includes/llm-rules-platform/javascript.react.mdx +++ b/platform-includes/llm-rules-platform/javascript.react.mdx @@ -2,8 +2,8 @@ Sentry provides a set of rules you can use to help your LLM use Sentry correctly. Copy this file and add it to your projects rules configuration. When created as a rules file this should be placed alongside other editor specific rule files. For example, if you are using Cursor, place this file in the `.cursor/rules` directory, or the contents in the `AGENTS.md` or `.cursorrules` (legacy) files. -{/_ ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/javascript/react.tsx). -If you make any changes, please update the getting started doc accordingly. _/} +{/* ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/javascript/react.tsx). +If you make any changes, please update the getting started doc accordingly. */} ````markdown {filename:rules.mdc} These examples should be used as guidance when configuring Sentry functionality within a project. From 694af1487b9329fc621999b8c16b98c55f6f00db Mon Sep 17 00:00:00 2001 From: Sergiy Dybskiy Date: Mon, 8 Dec 2025 11:39:03 -0500 Subject: [PATCH 3/3] import --- platform-includes/llm-rules-platform/_default.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-includes/llm-rules-platform/_default.mdx b/platform-includes/llm-rules-platform/_default.mdx index 34d0b648e726e..00bedaf779e9d 100644 --- a/platform-includes/llm-rules-platform/_default.mdx +++ b/platform-includes/llm-rules-platform/_default.mdx @@ -113,7 +113,7 @@ Sentry.init({ `Sentry.logger.fmt` is a template literal function that should be used to bring variables into the structured logs. ```javascript -import * as Sentry from "@sentry/nextjs"; +import * as Sentry from "@sentry/browser"; Sentry.logger.trace("Starting database connection", { database: "users" }); Sentry.logger.debug(Sentry.logger.fmt`Cache miss for user: ${userId}`);