ui: Use runInDebug to add error logging to logger service (#8658)

This commit is contained in:
John Cowen 2020-09-15 18:45:22 +01:00 committed by GitHub
parent f06e975395
commit 1732cda1e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -1,5 +1,15 @@
import Service from '@ember/service';
import { runInDebug } from '@ember/debug';
export default Service.extend({
execute: function(obj) {},
execute: function(obj) {
runInDebug(() => {
obj = typeof obj.error !== 'undefined' ? obj.error : obj;
if (obj instanceof Error) {
console.error(obj); // eslint-disable-line no-console
} else {
console.log(obj); // eslint-disable-line no-console
}
});
},
});

View File

@ -7,7 +7,7 @@ export default Service.extend({
logger: service('logger'),
// @xstate/fsm
log: function(chart, state) {
this.logger.execute(`${chart.id} > ${state.value}`);
// this.logger.execute(`${chart.id} > ${state.value}`);
},
addGuards: function(chart, options) {
this.guards(chart).forEach(function([path, name]) {