/** * By default, this is set to {@link Logger.Level#INFO INFO}. This includes any internal errors * ({@link Logger.Level#ERROR ERROR}) and any security debug messages ({@link Logger.Level#INFO * INFO}) that the client receives. Set to {@link Logger.Level#DEBUG DEBUG} to turn on the * diagnostic logging, and {@link Logger.Level#NONE NONE} to disable all logging. * * @param logLevel The desired minimum log level */ public synchronized void setLogLevel(Logger.Level logLevel) { assertUnfrozen(); switch (logLevel) { case DEBUG: this.logLevel = com.google.firebase.database.logging.Logger.Level.DEBUG; break; case INFO: this.logLevel = com.google.firebase.database.logging.Logger.Level.INFO; break; case WARN: this.logLevel = com.google.firebase.database.logging.Logger.Level.WARN; break; case ERROR: this.logLevel = com.google.firebase.database.logging.Logger.Level.ERROR; break; case NONE: this.logLevel = com.google.firebase.database.logging.Logger.Level.NONE; break; default: throw new IllegalArgumentException("Unknown log level: " + logLevel); } }
@Override public void onCreate() { super.onCreate(); Realm.init(this); RealmConfiguration config = new RealmConfiguration.Builder() .deleteRealmIfMigrationNeeded() //.schemaVersion(2) // Must be bumped when the schema changes //.migration(new RealmContactMigration()) // Migration to run instead of throwing an exception .name("default.realm").build(); Realm.setDefaultConfiguration(config); if(database==null) { FirebaseDatabase.getInstance().setPersistenceEnabled(true); FirebaseDatabase.getInstance().setLogLevel(Logger.Level.DEBUG); } database = FirebaseDatabase.getInstance(); References.init(this, database); AppManager.getInstance().setContext(getApplicationContext()); AppManager.getInstance().setCountry(Country.getCountryFromSIM(getApplicationContext())); // Initialize image loader initImageLoader(this); }
@Override public synchronized void setLogLevel(LogLevel logLevel) { if (logLevel == LogLevel.DEBUG) { com.google.firebase.database.FirebaseDatabase.getInstance().setLogLevel(Logger.Level.DEBUG); } if (logLevel == LogLevel.ERROR) { com.google.firebase.database.FirebaseDatabase.getInstance().setLogLevel(Logger.Level.ERROR); } if (logLevel == LogLevel.INFO) { com.google.firebase.database.FirebaseDatabase.getInstance().setLogLevel(Logger.Level.INFO); } if (logLevel == LogLevel.NONE) { com.google.firebase.database.FirebaseDatabase.getInstance().setLogLevel(Logger.Level.NONE); } if (logLevel == LogLevel.WARN) { com.google.firebase.database.FirebaseDatabase.getInstance().setLogLevel(Logger.Level.WARN); } }
@Override public synchronized void setLogLevel(LogLevel logLevel) { if (logLevel == LogLevel.DEBUG) { com.google.firebase.database.FirebaseDatabase.getInstance(app).setLogLevel(Logger.Level.DEBUG); } if (logLevel == LogLevel.ERROR) { com.google.firebase.database.FirebaseDatabase.getInstance(app).setLogLevel(Logger.Level.ERROR); } if (logLevel == LogLevel.INFO) { com.google.firebase.database.FirebaseDatabase.getInstance(app).setLogLevel(Logger.Level.INFO); } if (logLevel == LogLevel.NONE) { com.google.firebase.database.FirebaseDatabase.getInstance(app).setLogLevel(Logger.Level.NONE); } if (logLevel == LogLevel.WARN) { com.google.firebase.database.FirebaseDatabase.getInstance(app).setLogLevel(Logger.Level.WARN); } }
@Provides @Singleton public FirebaseDatabase provideFirebaseDatabase() { FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance(); firebaseDatabase.setPersistenceEnabled(false); firebaseDatabase.setLogLevel(BuildConfig.DEBUG ? Logger.Level.DEBUG : Logger.Level.NONE); return firebaseDatabase; }
@SuppressWarnings("UnusedReturnValue") public RxFirebaseDatabase setLogLevel(Logger.Level level) { query.getRef().getDatabase().setLogLevel(level); return this; }
@Test public void shouldSetLogLevel() throws Exception { rx.setLogLevel(Logger.Level.DEBUG); then(database).should().setLogLevel(Logger.Level.DEBUG); }
public FirebaseDataManager() { super(); final FirebaseDatabase database = FirebaseDatabase.getInstance(); database.setLogLevel(BuildConfig.DEBUG ? Logger.Level.DEBUG : Logger.Level.NONE); database.setPersistenceEnabled(false); mDatabase = database.getReference(); mDatabaseCheckIn = mDatabase.child(TABLE_CHECK_IN); }
/** * If you would like to provide a custom log target, pass an object that implements the {@link * com.google.firebase.database.Logger Logger} interface. * * @hide * @param logger The custom logger that will be called with all log messages */ public synchronized void setLogger(com.google.firebase.database.logging.Logger logger) { assertUnfrozen(); this.logger = logger; }
/** * Used primarily for debugging. Limits the debug output to the specified components. By default, * this is null, which enables logging from all components. Setting this explicitly will also set * the log level to {@link Logger.Level#DEBUG DEBUG}. * * @param debugComponents A list of components for which logs are desired, or null to enable all * components */ public synchronized void setDebugLogComponents(List<String> debugComponents) { assertUnfrozen(); setLogLevel(Logger.Level.DEBUG); loggedComponents = debugComponents; }