diff --git a/platform-includes/llm-rules-platform/_default.mdx b/platform-includes/llm-rules-platform/_default.mdx index ef86d099d2edf..00bedaf779e9d 100644 --- a/platform-includes/llm-rules-platform/_default.mdx +++ b/platform-includes/llm-rules-platform/_default.mdx @@ -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; - -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..e736df744a870 100644 --- a/platform-includes/llm-rules-platform/javascript.nextjs.mdx +++ b/platform-includes/llm-rules-platform/javascript.nextjs.mdx @@ -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..2063cd998d732 100644 --- a/platform-includes/llm-rules-platform/javascript.node.mdx +++ b/platform-includes/llm-rules-platform/javascript.node.mdx @@ -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..52f99bb05b44a 100644 --- a/platform-includes/llm-rules-platform/javascript.react.mdx +++ b/platform-includes/llm-rules-platform/javascript.react.mdx @@ -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