Comparing version 0.8.0 to 0.8.1
@@ -290,5 +290,8 @@ "use strict"; | ||
* @param {String} stack The traced stack | ||
* @param {Number} [stackIndex=2] The element of the stack you want analyzed. | ||
* @returns {String} A location identifier for the location from where the logger was invoked. | ||
*/ | ||
var analyzeStack = function( stack ) { | ||
var analyzeStack = function( stack, stackIndex ) { | ||
stackIndex = stackIndex || 2; | ||
/** | ||
@@ -304,6 +307,6 @@ * Group 1: Function name (optional) | ||
// The method that invoked the logger is located at index 2 of the stack | ||
if( sites && 2 <= sites.length ) { | ||
if( sites && stackIndex <= sites.length ) { | ||
var callSiteElementPattern = new RegExp( /at (?:(.*) )?\(?(.*):(\d+):(\d+)\)?/ ); | ||
// Pick apart | ||
var callSiteElements = sites[ 2 ].match( callSiteElementPattern ); | ||
var callSiteElements = sites[ stackIndex ].match( callSiteElementPattern ); | ||
var functionName, fileName, line, column; | ||
@@ -310,0 +313,0 @@ // Assume either 4 (no function name) or 5 elements. |
{ | ||
"name": "fm-log", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"description": "Console logging facility for Node", | ||
@@ -5,0 +5,0 @@ "main": "lib/log.js", |
47227
573