From 7c62f1fd3ebbfdc6529a015e71a4456e8b4588ce Mon Sep 17 00:00:00 2001 From: GermanBluefox Date: Thu, 25 Aug 2016 22:04:36 +0200 Subject: [PATCH] Allow custom log function. Not only console --- lib/middleware.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/middleware.js b/lib/middleware.js index c9fff9c..b8a3cd1 100644 --- a/lib/middleware.js +++ b/lib/middleware.js @@ -2,7 +2,7 @@ var utils = require('./utils'); -function log(debug) { +function _log(debug) { if (debug) { var args = Array.prototype.slice.call(arguments); args.shift(); @@ -15,6 +15,7 @@ module.exports.create = function (le) { if (!le.challenge || !le.challenge.get) { throw new Error("middleware requires challenge plugin with get method"); } + var log = le.log || _log; log(le.debug, "created middleware"); return function (_app) {