forked from cnwangjie/better-onetab
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add Sentry & fix change order twice
- Loading branch information
Showing
11 changed files
with
141 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,5 @@ export const ADD_LIST = 'addList' | |
export const UPDATE_LIST_BY_ID = 'updateListById' | ||
export const REMOVE_LIST_BY_ID = 'removeListById' | ||
export const CHANGE_LIST_ORDER = 'changeListOrderRelatively' | ||
|
||
export const SENTRY_DSN = 'https://[email protected]/1307154' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import * as Sentry from '@sentry/browser' | ||
import {SENTRY_DSN} from './constants' | ||
import {isBackground} from './utils' | ||
import manifest from '../manifest.json' | ||
|
||
const logger = {} | ||
|
||
const genMethods = () => { | ||
for (const method in window.console) { | ||
if (typeof window.console[method] !== 'function') continue | ||
logger[method] = (...args) => { | ||
window.console[method](...args) | ||
args.forEach(arg => { | ||
if (arg instanceof Error) Sentry.captureException(arg) | ||
else Sentry.addBreadcrumb({data: arg, level: method}) | ||
}) | ||
} | ||
} | ||
} | ||
|
||
logger.init = (opts = {}) => { | ||
genMethods() | ||
window.onerror = window.onunhandledrejection = err => { | ||
Sentry.captureException(err) | ||
} | ||
const {Vue} = opts | ||
const integrations = Sentry.defaultIntegrations | ||
if (Vue) integrations.push(new Sentry.Integrations.Vue({Vue})) | ||
Sentry.init({ | ||
environment: DEBUG ? 'dev' : 'production', | ||
release: manifest.version, | ||
dsn: SENTRY_DSN, | ||
debug: DEBUG, | ||
integrations, | ||
}) | ||
|
||
Sentry.configureScope(async scope => { | ||
scope.setTag('background', await isBackground()) | ||
}) | ||
|
||
if (DEBUG) window.Sentry = Sentry | ||
} | ||
|
||
export default logger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,6 +128,58 @@ | |
esprima "^4.0.1" | ||
sprintf-js "^1.0.3" | ||
|
||
"@sentry/browser@^4.5.3": | ||
version "4.5.3" | ||
resolved "https://registry.npmjs.org/@sentry/browser/-/browser-4.5.3.tgz#69744d13b01c490f366cbf2676790624b9f7c0a0" | ||
integrity sha512-ePbsyXtZS9jWM0lD8rxA46omJjJcQPaRZak08TyxFBGm1YOUFvvNAA6rNjUtK4fFEznLhPA5YcllcOCBE2bPPg== | ||
dependencies: | ||
"@sentry/core" "4.5.3" | ||
"@sentry/types" "4.5.3" | ||
"@sentry/utils" "4.5.3" | ||
tslib "^1.9.3" | ||
|
||
"@sentry/[email protected]": | ||
version "4.5.3" | ||
resolved "https://registry.npmjs.org/@sentry/core/-/core-4.5.3.tgz#e55a42c694deec903aec2479e4a282d5a7a43878" | ||
integrity sha512-off7XkyyiPXJTQ1XYPzxsY3zLHztMdK1kuIeHzyoIzu4kvs8H75eqou+fADo04JmfaMNy+OZSoW+5Aq2SZR2Ng== | ||
dependencies: | ||
"@sentry/hub" "4.5.3" | ||
"@sentry/minimal" "4.5.3" | ||
"@sentry/types" "4.5.3" | ||
"@sentry/utils" "4.5.3" | ||
tslib "^1.9.3" | ||
|
||
"@sentry/[email protected]": | ||
version "4.5.3" | ||
resolved "https://registry.npmjs.org/@sentry/hub/-/hub-4.5.3.tgz#54ce5988ac6dedbe9bba99e2c00f8f26eb677dfe" | ||
integrity sha512-4b8oPVAGw/hf11CQN9J7hAk2wzD2HIZsQBl/PcB/p5r1UyHw8cibpVobJulkHJMBJMiZ/twIBGZ1G1qK3LJdhw== | ||
dependencies: | ||
"@sentry/types" "4.5.3" | ||
"@sentry/utils" "4.5.3" | ||
tslib "^1.9.3" | ||
|
||
"@sentry/[email protected]": | ||
version "4.5.3" | ||
resolved "https://registry.npmjs.org/@sentry/minimal/-/minimal-4.5.3.tgz#7b69481df2d61e4b935d067be62a52824190f616" | ||
integrity sha512-W9+eEZosoDKTAJkab/bxsSRim7I4lqeWHLhmCchDimKcdmpBzC+gOCT0PywwOWRLW08LhTHfmnNSAJv6PaZiCA== | ||
dependencies: | ||
"@sentry/hub" "4.5.3" | ||
"@sentry/types" "4.5.3" | ||
tslib "^1.9.3" | ||
|
||
"@sentry/[email protected]": | ||
version "4.5.3" | ||
resolved "https://registry.npmjs.org/@sentry/types/-/types-4.5.3.tgz#3350dce2b7f9b936a8c327891c12e3aef7bd8852" | ||
integrity sha512-7ll1PAFNjrBNX9rzy3P2qAQrpQwHaDO3uKj735qsnGw34OtAS8Xr8WYrjI14f9fMPa/XIeWvMPb4GMic28V/ag== | ||
|
||
"@sentry/[email protected]": | ||
version "4.5.3" | ||
resolved "https://registry.npmjs.org/@sentry/utils/-/utils-4.5.3.tgz#6893fca9fde230b230360779362752e9b5570852" | ||
integrity sha512-yIYqnuq9cd9nAUJ2MPmq++Mgy81qB2fglsDB8TiBfk2eaba79qFcKp8xg3w3EMDHZMlfmlx4fkTmZJ/+V02oWQ== | ||
dependencies: | ||
"@sentry/types" "4.5.3" | ||
tslib "^1.9.3" | ||
|
||
"@vue/component-compiler-utils@^2.0.0": | ||
version "2.3.1" | ||
resolved "https://registry.npmjs.org/@vue/component-compiler-utils/-/component-compiler-utils-2.3.1.tgz#d1c2623f02ad3fe6b6fc9c3762be55c9c61e3977" | ||
|
@@ -5408,7 +5460,7 @@ trim-right@^1.0.1: | |
dependencies: | ||
glob "^7.1.2" | ||
|
||
tslib@^1.9.0: | ||
tslib@^1.9.0, tslib@^1.9.3: | ||
version "1.9.3" | ||
resolved "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" | ||
integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== | ||
|