定制firefox console.log(为我自己的原型) [英] customizing firefox console.log (for my own prototype)
问题描述
请参阅这个问题了解更多细节。如果有兴趣,请在github上查看提交 880419d370d749 然后构建它,运行 ./ monimelt -Dweb,运行-W localhost.localdomain:8086 /
并打开 http://localhost.localdomain:8086 / canvedit.html 在您的Firefox。 FWIW我现在正在尝试使用画布。相关的代码可能会在我的 webroot / canvasedit.js ,但我不知道在那里编写代码...
我不是为Firefox开发的,我已经看到了这一点,但我偶然发现这一点:
好像有些东西可能回答您的需求。
I'm coding a (free software) application (the MELT monitor, on GNU/Linux/Debian/x86-64) which embeds its specific web server.
See this question for gory details. If interested, look into commit 880419d370d749 on github then build it, run ./monimelt -Dweb,run -W localhost.localdomain:8086/
and open http://localhost.localdomain:8086/canvedit.html in your Firefox. FWIW I'm now trying to use canvases. Relevant code might go in my webroot/canvasedit.js, but I don't know what to code there yet...
Firefox is version 38 or 42. I don't understand all the details of ConsoleAPI.js which probably is very relevant to my question.
Let suppose I have a prototype
var fooproto = {
// perhaps adding a toString function is enough here?
// I want to show num & sons
};
then I make some objects using it:
var foo1 = Object();
foo1.num = 11;
foo1.__proto__ = fooproto;
var foo2 = Object();
foo2.num = 37;
foo2.sons = [foo1];
foo2.__proto__ = fooproto;
I would like
console.log("foo2=", foo2);
to show something like foo2=
Foo#37[Foo#11] on the console (if possible with the italics)
Is there a way to change fooproto
to make that work? I guess that some mechanism exist, since console.log
is displaying nicely DOM objects.
It is probably a FAQ asked many times, but I was not able after several minutes of searching to find the appropriate search keywords. I don't know what terminology to use
I’m not developing for Firefox and apologies if you’ve already seen this, but I’ve stumbled across this:
- Custom output in the Web Console on MDN, and specifically console API
Seems like something that might answer your needs.
这篇关于定制firefox console.log(为我自己的原型)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!