Winston@3 Customize timestamp format
Trying to log errors with winston, here is how I created the logger
Very simple, it’s what the official document does. But the timestamp in the log file made no sense to me, since it’s ISO date.
'2018-07-27T06:48:08.696Z'
I read the document, it gives no hint of how to customize the date format. So I did the old-fashioned way, read the source code. The file is located at node_modules/logform/timestamp.js
So it either takes a {format: string}, or {format: function}, when passed a string, the string is delegated to fecha to format the date string; or winston calls the function which should return a string. It also supports alias, let’s have fun!
Sorry about the order of the files, I don’t know how to sort the files in Gist.