diff --git a/lib/bunyan.js b/lib/bunyan.js index 405cdb24..dfc5f31b 100644 --- a/lib/bunyan.js +++ b/lib/bunyan.js @@ -183,10 +183,10 @@ function getCaller3Info() { var obj = {}; var saveLimit = Error.stackTraceLimit; var savePrepare = Error.prepareStackTrace; - Error.stackTraceLimit = 3; + Error.stackTraceLimit = 4; Error.prepareStackTrace = function (_, stack) { - var caller = stack[2]; + var caller = stack[3]; if (sourceMapSupport) { caller = sourceMapSupport.wrapCallSite(caller); } @@ -197,7 +197,8 @@ function getCaller3Info() { obj.func = func; }; Error.captureStackTrace(this, getCaller3Info); - this.stack; + const err = new Error(); + err.stack; Error.stackTraceLimit = saveLimit; Error.prepareStackTrace = savePrepare;