Search Results

Search found 1 results on 1 pages for 'user420504'.

Page 1/1 | 1 

  • Is it possible to get the current request that is being served by node.js?

    - by user420504
    I am using express.js. I have a need to be able to log certain request data whenever someone tries to log a message. For this I would like to create a helper method like so function log_message(level, message){ winston.log(level, req.path + "" + message); } I would then use the method like so. exports.index = function(req, res){ log_message("info", "I'm here"); } Note that I am not passing the req object to the log_message function. I want that to be transparently done so that the log_message API user does not need to be aware of the common data that is being logged. Is there a way to achieve this with express.js/node.js. Is the request object available from a global variable of some sort?

    Read the article

1