
The `Logger.error()` method now only accepts a single `Error` parameter and passes this through to the error handler. This allows the error handler to serialize the error more accurately. The various places that use `Logger.error()` have been updated. See #21943#issuecomment-370230047 PR Close #22713
24 lines
478 B
TypeScript
24 lines
478 B
TypeScript
import { ErrorHandler, Injectable } from '@angular/core';
|
|
import { environment } from '../../environments/environment';
|
|
|
|
|
|
@Injectable()
|
|
export class Logger {
|
|
|
|
constructor(private errorHandler: ErrorHandler) {}
|
|
|
|
log(value: any, ...rest: any[]) {
|
|
if (!environment.production) {
|
|
console.log(value, ...rest);
|
|
}
|
|
}
|
|
|
|
error(error: Error) {
|
|
this.errorHandler.handleError(error);
|
|
}
|
|
|
|
warn(value: any, ...rest: any[]) {
|
|
console.warn(value, ...rest);
|
|
}
|
|
}
|