有没有办法停用所有的Firebase日志记录到控制台? [英] Is there someway to disable all firebase logging to console?
问题描述
我为我的Firebase安全规则创建了一些单元测试。部分测试正在尝试进行非法操作,并断言它们失败。
我的问题与噪音有关;当我使用nodeunit运行测试时,firebase客户端会吐出几个类似这样的日志:
$ b
FIREBASE WARNING:set at / user failed: permission_denied
我不希望这个输出有意做非法操作,因为它只会导致噪音和混乱。 $ b
正如加藤所说,似乎并没有官方的方法来禁用它。也就是说,如果你真的想要,进入源代码需要2秒钟,Ctrl + F代表WARNING,注释掉这一行:
undefined!== typeof console.warn?console.warn(b):console.log(b)
I have created some unit tests for my firebase security rules. Part of this testing is trying to do illegal operations and asserting that they fail.
My problem has to do with noise; when I run the tests using nodeunit, the firebase client spits out several logs similar to this:
FIREBASE WARNING: set at /user failed: permission_denied
I do not want this output when intentionally doing illegal operations as it just results in noise and confusion.
As Kato said, there doesn't appear to be an official way to disable it. That said, if you really want to, it takes 2 seconds to go into the source, Ctrl+F for "WARNING", and comment out this line:
"undefined"!==typeof console.warn?console.warn(b):console.log(b)
这篇关于有没有办法停用所有的Firebase日志记录到控制台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!