Display the request method in the log: don't assume GET

This commit is contained in:
Misha Wolfson 2016-12-15 17:56:28 -05:00
parent f1b7dd2a9d
commit fefcf3522e

View file

@ -77,12 +77,13 @@ var spserver = function (settings) {
var base = generateBase(path.resolve(finalSettings.file), finalSettings); var base = generateBase(path.resolve(finalSettings.file), finalSettings);
var server = http.createServer(function (req, res) { var server = http.createServer(function (req, res) {
logger.debug('[REQ] GET:', req.url); logger.debug('[REQ]', req.method + ':', req.url);
var startTime = new Date().getTime(); var startTime = new Date().getTime();
var done = function () { var done = function () {
var requestTime = new Date().getTime() - startTime; var requestTime = new Date().getTime() - startTime;
logger.debug('[RES] GET:', req.url, '(' + res.statusCode + ') took', requestTime, 'ms'); logger.debug('[RES]', req.method + ':', req.url,
'(' + res.statusCode + ')', 'took', requestTime, 'ms');
}; };
res.addListener('finish', done); res.addListener('finish', done);