Skip to content

Instantly share code, notes, and snippets.

@thisaurel
Created June 28, 2020 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thisaurel/4dfcb04fa14f16a5b7d52b56a50326ee to your computer and use it in GitHub Desktop.
Save thisaurel/4dfcb04fa14f16a5b7d52b56a50326ee to your computer and use it in GitHub Desktop.
import { Injectable } from '@angular/core';
import { environment } from '../../../environments/environment';
export interface ILoggerService {
info(value: any, ...rest: any[]): void;
log(value: any, ...rest: any[]): void;
warn(value: any, ...rest: any[]): void;
error(value: any, ...rest: any[]): void;
}
@Injectable({
providedIn: 'root'
})
export class ConsoleLoggerService implements ILoggerService {
info(value: any, ...rest: any[]): void {
if (!environment.production)
console.info(value, rest);
}
log(value: any, ...rest: any[]): void {
if (!environment.production)
console.log(value, rest);
}
warn(value: any, ...rest: any[]): void {
if (!environment.production)
console.warn(value, rest);
}
error(value: any, ...rest: any[]): void {
if (!environment.production)
console.error(value, rest);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment