|
@@ -0,0 +1,33 @@
|
|
|
|
+import * as Sentry from '@sentry/vue'
|
|
|
|
+
|
|
|
|
+export function initSentry(Vue) {
|
|
|
|
+ if (process.env.NODE_ENV === 'production') {
|
|
|
|
+ Sentry.init({
|
|
|
|
+ Vue,
|
|
|
|
+ dsn: 'https://30ebbe89657141879efcfc55dc59803b@jysentry.jydev.jianyu360.cn/11',
|
|
|
|
+ release: 'v1.0.0',
|
|
|
|
+ environment: 'produce',
|
|
|
|
+ sampleRate: 1,
|
|
|
|
+ beforeSend: (event) => {
|
|
|
|
+ let isTest = false
|
|
|
|
+ try {
|
|
|
|
+ isTest = window.navigator.userAgent.lastIndexOf('jy-test') !== -1
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.warn(e)
|
|
|
|
+ }
|
|
|
|
+ if (isTest) {
|
|
|
|
+ return null
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ event.user.email = localStorage.getItem('BIGMEMBER_PC')
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.warn(e)
|
|
|
|
+ }
|
|
|
|
+ return event
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ Sentry.setTag('url', location.href)
|
|
|
|
+ const id = document.cookie.match(/(^|;)\s*ud_safe\s*=\s*([^;]+)/)
|
|
|
|
+ Sentry.setUser({ id: id && id[2] })
|
|
|
|
+ }
|
|
|
|
+}
|