Skip to content

Commit

Permalink
Refactor function to lowest scope
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Dec 31, 2014
1 parent 2d4b96d commit fb20ec7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ exports = module.exports = function errorHandler(options) {

// default logging using console.error
if (log === true) {
log = function logerror(err, str) {
console.error(str)
}
log = logerror
}

return function errorHandler(err, req, res, next){
Expand Down Expand Up @@ -165,3 +163,12 @@ function stringify(val) {
? inspect(val)
: str
}

/**
* Log error to console.
* @api private
*/

function logerror(err, str) {
console.error(str)
}

0 comments on commit fb20ec7

Please sign in to comment.