[Webkit-unassigned] [Bug 20141] Cannot call pointer to function console.log
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Dec 3 12:49:08 PST 2010
https://bugs.webkit.org/show_bug.cgi?id=20141
Glenn Maynard <glenn at zewt.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |glenn at zewt.org
--- Comment #7 from Glenn Maynard <glenn at zewt.org> 2010-12-03 12:49:08 PST ---
Please reevaluate this.
Creating a wrapper causes an annoying problem: every stack trace from console logs ends at the wrapper you created, instead of the actual point of the log.
For example,
console.log("test 1");
var x = function() { console.log.apply(console, arguments); }
x("test 2");
x("test 3");
x("test 4");
usually shows:
test 1 logging.js:1
test 2 logging.js:2
test 3 logging.js:2
test 4 logging.js:2
It renders the stack frame useless in console summaries--every log using that function will always say "logging.js:2". Making the logging functions not depend on the this avoids this problem. Console should just be a namespace, and the functions in it should be closures on any objects they need access to.
(The more general fix for this is to add a parameter to the logging functions, giving a hint of how many stack frames should be ignored. That's particularly useful when you really do need to wrap logging, eg. to intercept and tee the log somewhere else.)
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list