如何像在 Python 客户端中一样自动从 Nodejs 捕获局部变量并发送到 Sentry?
我正在使用 Nodejs v12 和 Express 框架。
如何自动从前端、React.js 捕获局部变量?
Sentry 对此有一张票,https://github.com/getsentry/sentry-javascript/issues/990。他们在这方面没有取得任何进展,因为在 JS 中获取局部变量的名称和值几乎是不可能的。 获取作用域内的所有变量
2024 年 2 月 19 日更新
很简单:
Sentry.init({
dsn: '...',
includeLocalVariables: true
})
来源:https://blog.sentry.io/local-variables-for-nodejs-in-sentry/