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, warnings, 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.
Before you can add Firebase to your JavaScript app, you need to create a Firebase project and register your app with that project. When you register your app with Firebase, you'll get a Firebase configuration object that you'll use to connect your app with your Firebase project resources.
Linking your Firebase project to Cloud Logging allows you to view, search, and filter logs from your project. Firebase Hosting: After you link your project, it exports web request logs from your Firebase Hosting sites to Cloud Logging.
You can see logs in real time using the Firebase console. Choose your project, click the Functions product on the left, then click the Logs tab.
In the 3.0.0 version of Firebase, this has been changed to:
firebase.database.enableLogging(true);
See enableLoggging documentation.
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);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With