这可能是一个新手问题,但我想使用 JSON.stringify(API_responseObj) 在 captureMessage 和 captureException 中添加日志。
API_responseObj 在指纹和登录消息 obj 中的一些文本之后被修剪掉。
如果 console.log 添加了相同的信息而不是消息 obj 具有完整的信息,则可能是因为记录器是控制台。
你能给出一种方法,我可以将一个完整的响应对象以字符串格式添加到 Sentry 日志中,而不用循环遍历它的所有键,比如 JSON.stringify(OBJ) 来打印完整的对象。
谢谢。
嘿@kishor-bhatt,您可以使用extra
上下文来执行此操作 – https://docs.sentry.io/enriching-error-data/context/?platform=javascript
Sentry.withScope((scope) => {
scope.setExtra("response", API_responseObj);
Sentry.captureException(err);
});
嘿卡米尔,
我会用 setExtra 添加它。 感谢您澄清它。
问候,
基绍尔
2018 年 12 月 12 日星期三下午 3:39 Kamil Ogórek, notifications @github.com 写道:
嘿@kishor-bhatt https://github.com/kishor-bhatt ,你可以这样做
使用额外的上下文——
https://docs.sentry.io/enriching-error-data/context/?platform=javascriptSentry.withScope((范围) => {
scope.setExtra("response", API_responseObj);
Sentry.captureException(err);
});
—
你收到这个是因为你被提到了。
直接回复本邮件,在GitHub上查看
https://github.com/getsentry/sentry-javascript/issues/1794#issuecomment-446533014 ,
或静音线程
https://github.com/notifications/unsubscribe-auth/AQIaZTKfeiOdvQhli3awbC6Lu6iDi9jiks5u4NXwgaJpZM4ZPDwn
.
任何时间!
最有用的评论
嘿卡米尔,
我会用 setExtra 添加它。 感谢您澄清它。
问候,
基绍尔
2018 年 12 月 12 日星期三下午 3:39 Kamil Ogórek, notifications @github.com 写道: