Created
April 3, 2018 08:10
-
-
Save buildmotion/5121e32e30d6af271dd2563cb7179359 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, Optional } from '@angular/core'; | |
import { loggingServiceConfig } from './logging.service.config'; | |
import { Severity } from './severity.enum'; | |
@Injectable() | |
export class LoggingService { | |
applicationName = 'Angularlicio.us'; | |
serviceName = 'LoggingService'; | |
source: string; | |
severity: Severity; | |
message: string; | |
timestamp: Date; | |
log(source: string, severity: Severity, message: string) { | |
this.source = `${this.applicationName}.${source}`; | |
this.severity = severity; | |
this.message = message; | |
this.timestamp = new Date(); | |
const msg = `${this.message}`; | |
console.log(`${this.severity} from ${this.source}: ${msg} (${this.timestamp})`); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment