From aeeed54e112d0c0b5e98cdc80ec3b0d5baf61901 Mon Sep 17 00:00:00 2001
From: likun7981 <kun.li04@ele.me>
Date: Wed, 14 Dec 2016 14:48:47 +0800
Subject: [PATCH] add node console line number

---
 debug.js | 2 +-
 node.js  | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/debug.js b/debug.js
index fc634f7e..70384324 100644
--- a/debug.js
+++ b/debug.js
@@ -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) {
diff --git a/node.js b/node.js
index 15bf55af..981e883d 100644
--- a/node.js
+++ b/node.js
@@ -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`.
@@ -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');