Skip to content

Commit fb20ec7

Browse files
committed
Refactor function to lowest scope
1 parent 2d4b96d commit fb20ec7

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

index.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ exports = module.exports = function errorHandler(options) {
7373

7474
// default logging using console.error
7575
if (log === true) {
76-
log = function logerror(err, str) {
77-
console.error(str)
78-
}
76+
log = logerror
7977
}
8078

8179
return function errorHandler(err, req, res, next){
@@ -165,3 +163,12 @@ function stringify(val) {
165163
? inspect(val)
166164
: str
167165
}
166+
167+
/**
168+
* Log error to console.
169+
* @api private
170+
*/
171+
172+
function logerror(err, str) {
173+
console.error(str)
174+
}

0 commit comments

Comments
 (0)