Created
April 4, 2020 15:30
-
-
Save YannickFricke/970be95958ebd34df589ea128260a6b9 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 { createLogger, format, Logger, transports } from 'winston'; | |
const { Console } = transports; | |
export const getLogger = (): Logger => { | |
const consoleTransport = new Console({ | |
format: format.combine( | |
format.colorize(), | |
format.timestamp({ | |
format: 'DD.MM.YYYY HH:mm:ss', | |
}), | |
format.printf((info => `[${info.timestamp}] [${info.level}] ${info.message}`)), | |
), | |
level: 'silly', | |
}); | |
return createLogger({ | |
transports: [ | |
consoleTransport, | |
], | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment