如何开启Firebase Javascript客户端中的日志记录? [英] How do I turn on logging in the Firebase Javascript client?
问题描述
我正在运行我的节点模块 node myModule.js
打开日志记录功能可以调用:
Firebase.enableLogging(true);
它会登录到控制台。这个日志记录主要是为了内部调试的目的,它不是超级用户友好的。如果你想以编程方式捕获消息,而不是直接发送到控制台,你可以选择传递一个函数enableLogging:
Firebase.enableLogging(函数(logMessage)){//给消息添加一个时间戳
console。 log(new Date()。toISOString()+':'+ logMessage);
});
I'm connecting to firebase from a Node.js module. My Javascript code is supposed to be writing data to my firebase, but it isn't. I'm also not seeing any errors, warnins, etc. logged to the console. So how do I crank up logging for the firebase JS client to see what's actually going on? Does such a thing exist? I tried searching the firebase API docs, but couldn't find anything.
I'm running my Node module with node myModule.js
from the terminal in Mac OS X 10.9, in case it matters.
To turn on logging, you can call:
Firebase.enableLogging(true);
And it'll log to the console. This logging is mostly meant for internal debugging purposes though; it's not super user-friendly. But hopefully it'll help.
If you want to capture the messages programmatically instead of send them directly to the console, you can alternatively pass a function to enableLogging:
Firebase.enableLogging(function(logMessage) {
// Add a timestamp to the messages.
console.log(new Date().toISOString() + ': ' + logMessage);
});
这篇关于如何开启Firebase Javascript客户端中的日志记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!