Created
June 28, 2020 14:20
-
-
Save thisaurel/4dfcb04fa14f16a5b7d52b56a50326ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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