1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-07-29 14:08:31 +00:00

4.0.0-rc13.11

* Added: Debug Log generation and easy uploading for issue reports.
* Fixed: Bug with chat lines not having a state causing rendering to crash.
* Fixed: Add an error boundary around the custom FFZ Emote Menu to catch errors, displaying feedback and sending error reports rather than silently failing.
* Fixed: Typo in Fine when logging errors.
* Changed: Update chat types with the latest values from Twitch's source.
* Changed: Update the GitHub issue template with instructions on uploading logs from v4.
This commit is contained in:
SirStendec 2018-12-03 18:08:32 -05:00
parent cb2f2b19ee
commit d6504757b3
18 changed files with 413 additions and 99 deletions

View file

@ -6,12 +6,16 @@
// Raven Logging
// ============================================================================
import dayjs from 'dayjs';
import {DEBUG, SENTRY_ID} from 'utilities/constants';
import {has} from 'utilities/object';
import Module from 'utilities/module';
import Raven from 'raven-js';
const STRIP_URLS = /((?:\?|&)[^?&=]*?(?:oauth|token)[^?&=]*?=)[^?&]*?(&|$)/i;
const AVALON_REG = /\/(?:script|static)\/((?:babel\/)?avalon)(\.js)(\?|#|$)/,
fix_url = url => url.replace(AVALON_REG, `/static/$1.${__webpack_hash__}$2$3`);
@ -90,8 +94,8 @@ export default class RavenLogger extends Module {
});
this.settings.addUI('reports.error.example', {
path: 'Data Management > Reporting >> Error Reports',
component: 'example-report',
path: 'Data Management > Reporting >> Example Report',
component: 'async-text',
watch: [
'reports.error.enable',
@ -101,7 +105,9 @@ export default class RavenLogger extends Module {
data: () => new Promise(r => {
// Why fake an error when we can *make* an error?
this.__example_waiter = r;
this.__example_waiter = data => {
r(JSON.stringify(data, null, 4));
};
// Generate the error in a timeout so that the end user
// won't have a huge wall of a fake stack trace wasting
@ -121,7 +127,7 @@ export default class RavenLogger extends Module {
this.raven = Raven;
Raven.config(SENTRY_ID, {
const raven_config = {
autoBreadcrumbs: {
console: false
},
@ -134,9 +140,6 @@ export default class RavenLogger extends Module {
'Access is denied.',
'Zugriff verweigert'
],
whitelistUrls: [
/cdn\.frankerfacez\.com/
],
sanitizeKeys: [
/Token$/
],
@ -166,6 +169,10 @@ export default class RavenLogger extends Module {
return false;
}
// Don't send errors in debug mode.
//if ( DEBUG && !(data.tags && data.tags.example) )
// return false;
const exc = data.exception && data.exception.values[0];
// We don't want any of Sentry's junk.
@ -207,7 +214,38 @@ export default class RavenLogger extends Module {
return true;
}
}).install();
};
if ( ! DEBUG )
raven_config.whitelistUrls = [
/cdn\.frankerfacez\.com/
];
Raven.config(SENTRY_ID, raven_config).install();
}
generateLog() {
if ( ! this.raven || ! this.raven._breadcrumbs )
return 'No breadcrumbs to log.';
return this.raven._breadcrumbs.map(crumb => {
const time = dayjs(crumb.timestamp).locale('en').format('H:mm:ss');
if ( crumb.type == 'http' )
return `[${time}] HTTP | ${crumb.category}: ${crumb.data.method} ${crumb.data.url} -> ${crumb.data.status_code}`;
let cat = 'LOG';
if ( crumb.category && crumb.category.includes('ui.') )
cat = 'UI';
return `[${time}] ${cat}${crumb.level ? `:${crumb.level}` : ''} | ${crumb.category}: ${crumb.message}${crumb.data ? `\n ${JSON.stringify(crumb.data)}` : ''}`;
}).map(x => {
if ( typeof x !== 'string' )
x = `${x}`;
return x.replace(STRIP_URLS, '$1REDACTED$2');
}).join('\n');
}