morgan
HTTP request logger middleware for node.js
... is the HTTP response. The function is expected to return a string that will be the log line, or undefined / null to skip logging. Write log line on request instead of response. This means that a requests will be logged even if the server crashes, but data from the response (like the response code, content length, etc.) cannot be logged. To define a token, simply invoke morgan.token() with the name and a callback function.