https://github.com/angular/angular
Raw File
Tip revision: 99723fc64ed6ded3635ae5e19648550dc42f1bc1 authored by Alex Rickabaugh on 10 January 2023, 18:45:00 UTC
release: cut the v15.1.0 release
Tip revision: 99723fc
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