All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.leancloud.logging.DefaultLogger Maven / Gradle / Ivy

There is a newer version: 8.2.28
Show newest version
package cn.leancloud.logging;

import cn.leancloud.AVLogger.Level;
import android.util.Log;

public class DefaultLogger extends InternalLogger {
  private String tag = null;
  public DefaultLogger(String tag) {
    this.tag = tag;
  }
  protected void internalWriteLog(Level level, String msg) {
    switch (level) {
      case ALL:
      case VERBOSE:
        Log.v(tag, msg);
        break;
      case DEBUG:
        Log.d(tag, msg);
        break;
      case INFO:
        Log.i(tag, msg);
        break;
      case WARNING:
        Log.w(tag, msg);
        break;
      case ERROR:
        Log.e(tag, msg);
        break;
      default:
        break;
    }
  }

  protected void internalWriteLog(Level level, String msg, Throwable tr) {
    switch (level) {
      case ALL:
      case VERBOSE:
        Log.v(tag, msg, tr);
        break;
      case DEBUG:
        Log.d(tag, msg, tr);
        break;
      case INFO:
        Log.i(tag, msg, tr);
        break;
      case WARNING:
        Log.w(tag, msg, tr);
        break;
      case ERROR:
        Log.e(tag, msg, tr);
        break;
      default:
        break;
    }
  }

  protected void internalWriteLog(Level level, Throwable tr) {
    switch (level) {
      case WARNING:
        Log.w(tag, tr);
        break;
      default:
        break;
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy