-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sean Boult
committed
Nov 26, 2019
1 parent
e453f34
commit 0d756c0
Showing
6 changed files
with
371 additions
and
53 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import * as winston from 'winston'; | ||
|
||
const defaultLevel = process.env.LOG_LEVEL || 'info'; | ||
const { simple, splat, prettyPrint, colorize, json, combine, timestamp, printf } = winston.format; | ||
|
||
const myFormat = printf(({ level, message, label, timestamp }) => { | ||
return `[${timestamp}] ${level}: ${message}`; | ||
}); | ||
|
||
const combinedFormats = combine( | ||
timestamp({ | ||
format: 'YYYY-MM-DD HH:mm:ss' | ||
}), | ||
colorize(), | ||
myFormat, | ||
); | ||
|
||
let logger: winston.Logger = winston.createLogger({ | ||
format: combinedFormats, | ||
level: defaultLevel, | ||
transports: [ | ||
new winston.transports.Console({ }), | ||
], | ||
}); | ||
|
||
export default logger; |
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
Oops, something went wrong.