Last active
March 22, 2020 17:16
-
-
Save toufiq-austcse/effed2c3b5753b6a7f7f551e85a348ca to your computer and use it in GitHub Desktop.
This file contains hidden or 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 * as winston from 'winston'; | |
| export class LoggerService { | |
| private static myLogger = winston.createLogger({ | |
| format: winston.format.json(), | |
| transports: [ | |
| new winston.transports.File({filename: process.cwd() + '/project.logs'}), | |
| ], | |
| }); | |
| static writeErrorLog(msg) { | |
| this.myLogger.error({ | |
| timeStamp: new Date().toLocaleString(), | |
| message: msg, | |
| }) | |
| } | |
| static writeInfoLog(msg) { | |
| this.myLogger.info({ | |
| timeStamp: new Date().toLocaleString(), | |
| message: msg, | |
| }) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment