jshint: Turn on ES6 mode, fix a few issues in new logging file
FREEBIE
This commit is contained in:
parent
6b11f67dc6
commit
ba2df1f95b
2 changed files with 6 additions and 7 deletions
|
@ -29,6 +29,7 @@
|
||||||
"debug" : false,
|
"debug" : false,
|
||||||
"eqnull" : false,
|
"eqnull" : false,
|
||||||
"es5" : false,
|
"es5" : false,
|
||||||
|
"esversion" : 6,
|
||||||
"esnext" : false,
|
"esnext" : false,
|
||||||
"moz" : false,
|
"moz" : false,
|
||||||
"evil" : false,
|
"evil" : false,
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const electron = require('electron');
|
const electron = require('electron');
|
||||||
const bunyan = require('bunyan');
|
const bunyan = require('bunyan');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
@ -35,13 +33,13 @@ function log() {
|
||||||
console._log.apply(console, consoleArgs);
|
console._log.apply(console, consoleArgs);
|
||||||
|
|
||||||
const str = args.join(' ').replace(PHONE_REGEX, "+[REDACTED]$1");
|
const str = args.join(' ').replace(PHONE_REGEX, "+[REDACTED]$1");
|
||||||
ipc.send('log-info', str)
|
ipc.send('log-info', str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.console) {
|
if (window.console) {
|
||||||
console._log = console.log;
|
console._log = console.log;
|
||||||
console.log = log;
|
console.log = log;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
// The mechanics of preparing a log for publish
|
// The mechanics of preparing a log for publish
|
||||||
|
@ -69,7 +67,7 @@ function format(entries) {
|
||||||
|
|
||||||
function fetch() {
|
function fetch() {
|
||||||
return getHeader() + '\n' + format(ipc.sendSync('fetch-log'));
|
return getHeader() + '\n' + format(ipc.sendSync('fetch-log'));
|
||||||
};
|
}
|
||||||
|
|
||||||
function publish(log) {
|
function publish(log) {
|
||||||
log = log || fetch();
|
log = log || fetch();
|
||||||
|
@ -90,7 +88,7 @@ function publish(log) {
|
||||||
})
|
})
|
||||||
.fail(resolve);
|
.fail(resolve);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
// A modern logging interface for the browser
|
// A modern logging interface for the browser
|
||||||
|
@ -129,7 +127,7 @@ window.log = {
|
||||||
trace: _.partial(logAtLevel, 'trace'),
|
trace: _.partial(logAtLevel, 'trace'),
|
||||||
fetch,
|
fetch,
|
||||||
publish,
|
publish,
|
||||||
}
|
};
|
||||||
|
|
||||||
window.onerror = function(message, script, line, col, error) {
|
window.onerror = function(message, script, line, col, error) {
|
||||||
log.error(error.stack);
|
log.error(error.stack);
|
||||||
|
|
Loading…
Reference in a new issue