Thursday, 27 April 2017

How to put timestamp in express js?

I tried putting timestamp for all my requests.I used morgan for that and i include like below,

if (process.env.NODE_ENV === 'development') {
    // Enable logger (morgan)
    app.use(morgan('common'));
  }

This results in my console as,

::ssss:197.7.8.1 - - [Fri, 28 Apr 2017 00:28:29 GMT] "GET /assets/jqwidgets/styles/images/icon-right.png HTTP/1.1" 200 143
::ssss:197.7.8.1 - - [Fri, 28 Apr 2017 00:28:29 GMT] "GET /assets/jqwidgets/styles/images/icon-left.png HTTP/1.1" 200 139
::ssss:197.7.8.1- - [Fri, 28 Apr 2017 00:28:31 GMT] "GET /admin-get-users

From the above results I i am getting the timestamp as well as the internet address(::ssss:197.7.8.10which i dont want.Can anyone please suggest me help.I f any new module suggested is also a good solution for me.Thanks.



via MMR

No comments:

Post a Comment