Package Exports
- debug-caller
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (debug-caller) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
debug-caller
A wrapper around the debug module,
providing the additional ability to determine the calling file name for debug,
using caller. Now you get unique namespaces
each time you use debug!
Quick Examples
When you invoke debug-caller, you must specify the application name, and
can optionally specify the depth. If you do not specify the depth, it will
default to 1, using the immediate calling file name to build the decorator
for the debug instance. Below are some examples:
Basic usage
// foo.js
var logger = require("debug-caller")("myApp");
logger.log("logging data"); // "myApp:foo logging data"Used in a logging utility
// logger.js
var debugCaller = require("debug-caller");
module.exports = function() {
// set a depth of 2 to avoid using this file within debug statements
// (since this is just a passthrough for logging)
return debugCaller("myOtherApp", 2);
};// bar.js
var logger = require("./logger")();
logger.log("doing work"); // "myOtherApp:bar doing work"API
log()
Uses the default debug logging (console.log) to output debug messages.
error()
Binds the logging to console.error for the debug messages.
Access Debug
If you need access to the debug module directly, it's available off the
require'd debug-caller object:
var debugCaller = require("debug-caller");
// enable the app namespace debug output
debugCaller.debug.enable("myApp*");
// ...Etc
- Licence: MIT
- Dependency Status: