Time-stamp and Date your console or log messages

While writing Javascript code to automate build and deploy plans for Atlassian Bamboo, I found the need to easily time-stamp and date the log messages because the console logging in my DevOps code is written to the build logs. When builds fail we need all the information we can get. I found a nice npm package called “console-stamp” that does this for me. Here’s an example usage.

// logger.js

require('console-stamp')(console, { pattern: 'dd/mm/yyyy HH:MM:ss.l' });

function main() {
   console.info('Time-stamped and dated message.');


And, here’s some console output.

[07/03/2019 21:14:36.616] [INFO]   Here is our first timestamped and dated log message.


The end.

Leave a Comment

Your email address will not be published. Required fields are marked *