lib/debug-caller.js
function _buildNamespace(appName, depth) {
    var callerFile;

    // Our default depth needs to be 2, since 1 is this file. Add the user
    // supplied depth to 1 (for this file) to make it 2.
    callerFile = caller(depth + 1);

    // if for some reason we're unable to determine the caller, use the appName only
    if (!callerFile) {
        return appName;
    }

    // TODO in later versions of Node (v0.12.+), there is simple `path.parse`
    // which will provide us with the file name property. But until most have
    // moved up to that version, find the caller file name in this way...

    // find the filename from the path
    callerFile = path.basename(callerFile);

    // strip off the suffix (if any)
    if (path.extname(callerFile)) {
        callerFile = callerFile.slice(0, callerFile.indexOf(path.extname(callerFile)));
    }

    return appName + ":" + callerFile;
}
function _buildNamespace(appName, depth) {
    var callerFile;

    // Our default depth needs to be 2, since 1 is this file. Add the user
    // supplied depth to 1 (for this file) to make it 2.
    callerFile = caller(depth + 1);

    // if for some reason we're unable to determine the caller, use the appName only
    if (!callerFile) {
        return appName;
    }

    // TODO in later versions of Node (v0.12.+), there is simple `path.parse`
    // which will provide us with the file name property. But until most have
    // moved up to that version, find the caller file name in this way...

    // find the filename from the path
    callerFile = path.basename(callerFile);

    // strip off the suffix (if any)
    if (path.extname(callerFile)) {
        callerFile = callerFile.slice(0, callerFile.indexOf(path.extname(callerFile)));
    }

    return appName + ":" + callerFile;
}
function _buildNamespace ( appName , depth ) { var callerFile ; // Our default depth needs to be 2, since 1 is this file. Add the user // supplied depth to 1 (for this file) to make it 2. callerFile = caller ( depth + 1 ) ; // if for some reason we're unable to determine the caller, use the appName only if ( ! callerFile ) { return appName ; } // TODO in later versions of Node (v0.12.+), there is simple `path.parse` // which will provide us with the file name property. But until most have // moved up to that version, find the caller file name in this way... // find the filename from the path callerFile = path . basename ( callerFile ) ; // strip off the suffix (if any) if ( path . extname ( callerFile ) ) { callerFile = callerFile . slice ( 0 , callerFile . indexOf ( path . extname ( callerFile ) ) ) ; } return appName + ":" + callerFile ; }
Returns the descriptive text used in the debug instantiation, which at this
point is the app + calling filename. Allow the user to specify a depth for the
calling filename, in the case they have a wrapping function calling this.

@param  {String} appName The application name, used in the namespace
@param  {Number} depth   Depth used to determine caller filename

@return {String}         The app + calling filename
Returns the descriptive text used in the debug instantiation which at this point is the app + calling filename . Allow the user to specify a depth for the calling filename in the case they have a wrapping function calling this .