使用
"@sentry/browser": "5.30.0"
.
如何配置Sentry,以便定制Sentry发送的消息?
我对文件的理解是
transport
属性是允许这样做的,但我不知道我应该传递什么作为参数。
Sentry.init({
dsn: '...',
autoSessionTracking: false,
transport: (options: TransportOptions)=>{
return new MyFetchTransport(options);
},
});
class MyFetchTransport extends FetchTransport {
constructor(options: TransportOptions){
super(options);
}
sendEvent(event: Event): PromiseLike<Response>{
return super.sendEvent(event);
}
sendSession(session: Session): PromiseLike<Response>{
return super.sendSession(session);
}
}
上面给出了一个Typescript错误:
Type '(options: TransportOptions) => MyFetchTransport' is not assignable to type 'TransportClass<Transport>'.
Type '(options: TransportOptions) => MyFetchTransport' provides no match for the signature 'new (options: TransportOptions): Transport'. TS2322
如果我想定制Sentry发送消息的方式,init调用应该是什么样子?