https://github.com/angular/angular
Raw File
Tip revision: cbba7152fd2a533277b88aca98a50339d098d9f7 authored by Jessica Janiuk on 17 March 2021, 17:43:01 UTC
release: cut the v11.2.6 release (#41247)
Tip revision: cbba715
logger.service.ts
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);
  }
}
back to top