1 | ;
|
2 |
|
3 | var log = require('debug')(
|
4 | 'express-expeditious'
|
5 | );
|
6 |
|
7 | /**
|
8 | * Generates a log function that will always prepend "$METHOD $URL"
|
9 | * @param {IncomingRequest} req
|
10 | * @return {Function}
|
11 | */
|
12 | module.exports = function (req) {
|
13 | return function _log () {
|
14 | var str = req.method + ' ' + req.originalUrl
|
15 | , args = Array.prototype.slice.call(arguments);
|
16 |
|
17 | args[0] = str += (' - ' + args[0]);
|
18 |
|
19 | log.apply(log, args);
|
20 | };
|
21 | };
|