javascript - How to output timestamp when node.js server is restarted via grunt-nodemon? -


i have simple hello world nodejs express application , added grunt-nodemon should watch changes on *.js files. here console output when run grunt , change .js file:

running "nodemon:dev" (nodemon) task              [nodemon] v1.3.7                                  [nodemon] restart @ time, enter `rs`      [nodemon] watching: *.*                           [nodemon] starting `node server.js`               example app listening @ http://:::3000           [nodemon] restarting due changes...            [nodemon] starting `node server.js`               example app listening @ http://:::3000      

is there way see timestamp prepended each of these lines in console log? eg.

18:44:21 - running "nodemon:dev" (nodemon) task              18:44:21 - [nodemon] v1.3.7                                  18:44:21 - [nodemon] restart @ time, enter `rs`      ... 

i'd see in console when last server restart. here gruntfile.js:

module.exports = function (grunt) {   grunt.initconfig({     nodemon: {       dev: {         script: 'server.js',         options: {           ext: ['js']         }       }     }   });    grunt.loadnpmtasks('grunt-nodemon');   grunt.registertask('default', ['nodemon']) }; 

rather try modify output of nodemon, cleaner approach application log timestamp when starts up.

if use util.log function rather console.log, you'll timestamp added automatically log messages.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -