Skip to content

Commit 9980c28

Browse files
authored
feat: add sentry logging option (#654)
* Add logging and profiling options to Sentry init * Fix typo in enableLogs assignment * Update @sentry/node dependency to version 9.41.0 * Update package-lock.json and pnpm-lock.json to respect new sentry version * Delete package-lock.json * Put enableLogs above profiling options according to ESLint Removed duplicate logging configuration in Sentry initialization. * Rearrange Logs to be above Profiling according ESLint * Rearrange enableLogs to be above integrations according to ESLint
1 parent 6d2c76f commit 9980c28

3 files changed

Lines changed: 104 additions & 5 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"@fastify/jwt": "^9.0.4",
5858
"@fastify/multipart": "^9.0.3",
5959
"@prisma/client": "^5.22.0",
60-
"@sentry/node": "^9.38.0",
60+
"@sentry/node": "^9.41.0",
6161
"@sentry/profiling-node": "^9.38.0",
6262
"archiver": "^7.0.1",
6363
"boxen": "^7.1.1",
@@ -106,4 +106,4 @@
106106
"utf-8-validate": "^5.0.10",
107107
"zlib-sync": "^0.1.9"
108108
}
109-
}
109+
}

pnpm-lock.yaml

Lines changed: 96 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/sentry-init.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ const Sentry = require('@sentry/node');
44

55
Sentry.init({
66
dsn: process.env.SENTRY_DSN,
7-
// Profiling
7+
// Logging
8+
enableLogs: process.env.SENTRY_LOGGING === 'true',
89
integrations: [
10+
// Send console logs to Sentry
11+
Sentry.consoleLoggingIntegration({ levels: ["log", "warn", "error"] }),
12+
// Profiling
913
nodeProfilingIntegration(),
1014
],
15+
1116
// Profiling
1217
profileLifecycle: 'trace',
1318
profileSessionSampleRate: parseFloat(process.env.SENTRY_PROFILING_RATE?? 1.0),

0 commit comments

Comments
 (0)