Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function createDebug(namespace) {
debug.namespace = namespace;
debug.enabled = exports.enabled(namespace);
debug.useColors = exports.useColors();
debug.color = selectColor(namespae);
debug.color = selectColor(namespace);

// env-specific initialization logic for debug instances
if ('function' === typeof exports.init) {
Expand Down
9 changes: 8 additions & 1 deletion node.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
var stream = 1 === fd ? process.stdout :
2 === fd ? process.stderr :
createWritableStdioStream(fd);
/**
* Get debug line
*/

function getDebugLine() {
return (new Error()).stack.split('\n')[4].split(':')[1];
}

/**
* Is stdout a TTY? Colored output is enabled when `true`.
Expand Down Expand Up @@ -104,7 +111,7 @@ function formatArgs(args) {

if (useColors) {
var c = this.color;
var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
var prefix = ' \u001b[3' + c + ';1m' + name + ':' + getDebugLine() + ' ' + '\u001b[0m';

args[0] = prefix + args[0].split('\n').join('\n' + prefix);
args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
Expand Down