Allow custom log function. Not only console

This commit is contained in:
GermanBluefox 2016-08-25 22:04:36 +02:00 committed by GitHub
parent b3bb80a480
commit 7c62f1fd3e
1 changed files with 2 additions and 1 deletions

View File

@ -2,7 +2,7 @@
var utils = require('./utils'); var utils = require('./utils');
function log(debug) { function _log(debug) {
if (debug) { if (debug) {
var args = Array.prototype.slice.call(arguments); var args = Array.prototype.slice.call(arguments);
args.shift(); args.shift();
@ -15,6 +15,7 @@ module.exports.create = function (le) {
if (!le.challenge || !le.challenge.get) { if (!le.challenge || !le.challenge.get) {
throw new Error("middleware requires challenge plugin with get method"); throw new Error("middleware requires challenge plugin with get method");
} }
var log = le.log || _log;
log(le.debug, "created middleware"); log(le.debug, "created middleware");
return function (_app) { return function (_app) {