Last active
July 27, 2017 19:12
-
-
Save wKoza/4371f77f231e44379f9786b5b33f1d7d 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'; | |
@Injectable() | |
export class LoggerService { | |
logs: Array<string> = []; | |
level: number= 2; //debug:2, info:1, error:0 | |
debug(message: string) { | |
this.logs.push(message); | |
if(this.level == 2) console.log(message); | |
} | |
error(message: string){ | |
this.logs.push(message); | |
if(this.level >= 0)console.error(message); | |
} | |
info(message: string){ | |
this.logs.push(message); | |
if(this.level >= 1) console.info(message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment