From: Dan Vanderkam Date: Wed, 21 Dec 2011 19:28:52 +0000 (-0500) Subject: Incorporate Paul's stack trace logging fix. X-Git-Tag: v1.0.0~397^2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=0d319fa583988865589a7406810b1d46fd77c554;p=dygraphs.git Incorporate Paul's stack trace logging fix. --- 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') {