mirror of https://github.com/hashicorp/consul
ui: Use runInDebug to add error logging to logger service (#8658)
parent
f06e975395
commit
1732cda1e6
|
@ -1,5 +1,15 @@
|
||||||
import Service from '@ember/service';
|
import Service from '@ember/service';
|
||||||
|
import { runInDebug } from '@ember/debug';
|
||||||
|
|
||||||
export default Service.extend({
|
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
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,7 +7,7 @@ export default Service.extend({
|
||||||
logger: service('logger'),
|
logger: service('logger'),
|
||||||
// @xstate/fsm
|
// @xstate/fsm
|
||||||
log: function(chart, state) {
|
log: function(chart, state) {
|
||||||
this.logger.execute(`${chart.id} > ${state.value}`);
|
// this.logger.execute(`${chart.id} > ${state.value}`);
|
||||||
},
|
},
|
||||||
addGuards: function(chart, options) {
|
addGuards: function(chart, options) {
|
||||||
this.guards(chart).forEach(function([path, name]) {
|
this.guards(chart).forEach(function([path, name]) {
|
||||||
|
|
Loading…
Reference in New Issue