From 0d319fa583988865589a7406810b1d46fd77c554 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Wed, 21 Dec 2011 14:28:52 -0500 Subject: [PATCH] Incorporate Paul's stack trace logging fix. --- dygraph-utils.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dygraph-utils.js b/dygraph-utils.js index a391190..82d9189 100644 --- a/dygraph-utils.js +++ b/dygraph-utils.js @@ -44,16 +44,18 @@ Dygraph.log = function(severity, message) { if (typeof(printStackTrace) != 'undefined') { // Remove uninteresting bits: logging functions and paths. var st = printStackTrace({guess:false}); - while (st[0].indexOf("Function.log") != 0) { + while (st[0].indexOf("stacktrace") != -1) { st.splice(0, 1); } + st.splice(0, 2); for (var i = 0; i < st.length; i++) { - st[i] = st[i].replace(/\([^)]*\/(.*)\)/, '($1)') + st[i] = st[i].replace(/\([^)]*\/(.*)\)/, '@$1') .replace(/\@.*\/([^\/]*)/, '@$1') .replace('[object Object].', ''); } - message += ' (' + st.splice(0, 1) + ')'; + var top_msg = st.splice(0, 1)[0]; + message += ' (' + top_msg.replace(/^.*@ ?/, '') + ')'; } if (typeof(console) != 'undefined') { -- 2.7.4