mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-07-26 04:28:31 +00:00
The Report Your Errors Update
* Add automatic error reporting with Sentry.io * Filter a bunch of bad errors from showing up on Sentry * Add module.hasModule method. * Fix deep_copy * Fix disallow mouse interaction with extensions * Add some new icons to the icon font for mod cards * Allow Ctrl-Shift-Clicking emotes. * Rarity sorting for experiments and unset display for unused experiments.
This commit is contained in:
parent
e3a7e3b64d
commit
d7a07a5612
32 changed files with 575 additions and 83 deletions
|
@ -1,12 +1,21 @@
|
|||
'use strict';
|
||||
|
||||
const RAVEN_LEVELS = {
|
||||
1: 'debug',
|
||||
2: 'info',
|
||||
4: 'warn',
|
||||
8: 'error'
|
||||
};
|
||||
|
||||
|
||||
export default class Logger {
|
||||
constructor(parent, name, level) {
|
||||
constructor(parent, name, level, raven) {
|
||||
this.parent = parent;
|
||||
this.name = name;
|
||||
|
||||
this.enabled = true;
|
||||
this.level = level || (parent && parent.level) || Logger.DEFAULT_LEVEL;
|
||||
this.raven = raven || (parent && parent.raven);
|
||||
|
||||
this.children = {};
|
||||
}
|
||||
|
@ -34,6 +43,24 @@ export default class Logger {
|
|||
return this.invoke(Logger.ERROR, args);
|
||||
}
|
||||
|
||||
crumb(...args) {
|
||||
if ( this.raven )
|
||||
return this.raven.captureBreadcrumb(...args);
|
||||
}
|
||||
|
||||
capture(exc, opts, ...args) {
|
||||
if ( this.raven ) {
|
||||
opts = opts || {};
|
||||
if ( ! opts.logger )
|
||||
opts.logger = this.name;
|
||||
|
||||
this.raven.captureException(exc, opts);
|
||||
}
|
||||
|
||||
if ( args.length )
|
||||
return this.error(...args);
|
||||
}
|
||||
|
||||
/* eslint no-console: "off" */
|
||||
invoke(level, args) {
|
||||
if ( ! this.enabled || level < this.level )
|
||||
|
@ -41,6 +68,12 @@ export default class Logger {
|
|||
|
||||
const message = Array.prototype.slice.call(args);
|
||||
|
||||
this.crumb({
|
||||
message: message.join(' '),
|
||||
category: this.name,
|
||||
level: RAVEN_LEVELS[level] || level
|
||||
});
|
||||
|
||||
if ( this.name )
|
||||
message.unshift(`%cFFZ [%c${this.name}%c]:%c`, 'color:#755000; font-weight:bold', '', 'color:#755000; font-weight:bold', '');
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue