2023-03-14 13:18:55 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
* SPDX-License-Identifier: BUSL-1.1
|
2023-03-14 13:18:55 +00:00
|
|
|
*/
|
|
|
|
|
2018-05-22 15:11:30 +00:00
|
|
|
import Service from '@ember/service';
|
2020-09-15 17:45:22 +00:00
|
|
|
import { runInDebug } from '@ember/debug';
|
2018-05-22 15:11:30 +00:00
|
|
|
|
2020-11-09 09:25:35 +00:00
|
|
|
export default class LoggerService extends Service {
|
|
|
|
execute(obj) {
|
2020-09-15 17:45:22 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
});
|
2020-11-09 09:25:35 +00:00
|
|
|
}
|
|
|
|
}
|