类com.google.firebase.database.Logger源码实例Demo

下面列出了怎么用com.google.firebase.database.Logger的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: geofire-android   文件: GeoFireTestingRule.java
public void before(Context context) throws Exception {
    if (FirebaseApp.getApps(context).isEmpty()) {
        FirebaseOptions firebaseOptions = new FirebaseOptions.Builder()
                .setApplicationId("1:1010498001935:android:f17a2f247ad8e8bc")
                .setApiKey("AIzaSyBys-YxxE7kON5PxZc5aY6JwVvreyx_owc")
                .setDatabaseUrl(databaseUrl)
                .build();
        FirebaseApp.initializeApp(context, firebaseOptions);
        FirebaseDatabase.getInstance().setLogLevel(Logger.Level.DEBUG);
    }

    if (FirebaseAuth.getInstance().getCurrentUser() == null) {
        Task<AuthResult> signInTask = TaskUtils.waitForTask(FirebaseAuth.getInstance().signInAnonymously());
        if (signInTask.isSuccessful()) {
            Log.d(TAG, "Signed in as " + signInTask.getResult().getUser());
        } else {
            throw new Exception("Failed to sign in: " + signInTask.getException());
        }
    }

    this.databaseReference = FirebaseDatabase.getInstance().getReferenceFromUrl(databaseUrl);
}
 
源代码2 项目: firebase-android-sdk   文件: DatabaseConfig.java
/**
 * 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);
  }
}
 
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);


}
 
源代码4 项目: firebase-android-sdk   文件: DatabaseConfig.java
/**
 * 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;
}
 
源代码5 项目: firebase-android-sdk   文件: DatabaseConfig.java
/**
 * 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;
}