How to enableLogging(true) in Angularfire2


#1

Hi

I am struggling to get some firebase issues out of the way. I am using Angularfire2 and breaking my head (and google) to enableLogging(true)

firebase.database().enableLogging(true);

(also as per issue template angularfire2.

https://firebase.google.com/docs/reference/js/firebase.database#.enableLogging

Trying to declare and import firebase stuff, but not working. Was digging in the angularfire2 code to figure out where the firebase api reference is located, but couldn’t find it…

Anyone already done this before using Angularfire2?


#2

I don’t know. But I know the AF2 team intentionally provided only a portion of the Firebase API. This was a source of debate, but is the way it is. It may well be that enableLogging is not supported. Have you tried using standard Firebase auth instead of AngularFireAuth?


#4

Nope, but will look into it, also completely removing Angularfire2… Losing the point of using it this way.

Thx!


#5

To me, the most convincing use case for AngularFire2 is if you need to listen to a list that might change from outside, like the messages of a chat program. If most of your content is static, or changes based on user input, using AF seems less important.


#6

Hi

I received the suggestion from one of the Angularfire2 people to do the following to enable the debugging, but this didn’t work. So I removed Angularfire2 completely which actually was quite easy and works great with the debugging enabled.

import firebase from 'firebase/app';
import 'firebase/database';

firebase.firebase.database().enableLogging(true);

So, maybe this helps someone else, but it didn’t for me.

Regards

Tom