从Firefox加载项进行控制台日志记录 [英] Console logging from a Firefox add-on

查看:1331
本文介绍了从Firefox加载项进行控制台日志记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Mozilla文档( https: //addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/console.html )说我应该使用 console.log 从扩展程序生成消息。这些消息据说出现在Firefox错误控制台中。但是这不是我的情况。我今天第一次使用Addon构建器,我想创建一个扩展,在某些事件上切换标签。选项卡确实切换,并到一个选项卡,我预计,所以我的代码绝对运行。但是console.log输出无处可见。

The Mozilla documentation (https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/console.html) says that I should use console.log to generate messages from an extension. Those messages are said to appear in the Firefox Error Console. But this is not the case for me. I'm using the Addon builder for the first time today, and I'd like to create an extension that switches tabs on certain events. The tabs are indeed switched, and to a tab which I expected, so my code definitely runs. But the console.log output is nowhere to see.

我已将过滤器设置为All。我所看到的是来自addon生成器本身的CSS警告。

I have set the filter to "All". All I see are CSS warnings from the addon builder itself.

我也安装了Firebug。它也没有显示任何东西。 (这个工作正常,但使用console.log从网页的上下文虽然。)Firebug的问题是,它只启用一个/某些选项卡,所以当切换选项卡,它是无用的。

I have also installed Firebug. It doesn't show anything, too. (This works fine when using console.log from the context of a web page though.) The problem with Firebug would be that it's only enabled for one/some tab anyway, so when switching tabs, it's useless. I need a log window that's always there.

因此,console.log的输出将在哪里结束?

So where will the output from console.log end up?

推荐答案

继续在你的addon中添加一个测试 console.log(something) ;

Go ahead and put a test console.log("something") in your addon main();

如果错误控制台(邮件选项卡)中没有显示任何内容,则Firefox可能未配置为显示 console.log (最近发生在jetpack sdk 1.14)。请参阅:对console.log的更改详细信息,请参阅SDK 1.14中的行为

If nothing shows up in the Error Console ('Messages' tab), then maybe Firefox isn't configured to show console.log (happened recently with jetpack sdk 1.14). See: Changes to console.log behaviour in SDK 1.14 for details.

快速和脏的摘要:在 about:config set extensions.sdk.console。 logLevel all

Quick and dirty summary: In about:config set extensions.sdk.console.logLevel to "all"

虽然从您的问题:


我已将过滤器设置为全部。

I have set the filter to "All".

...它听起来像你已经意识到这一点。所以这并不完全清楚你的意思。

... it sounded like your were already aware of this. So it's not entirely clear what you meant by that.

这篇关于从Firefox加载项进行控制台日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆