转自: https://blog.csdn.net/qq_28193019/article/details/91050915

生成TAG

logt+Tab键:

private static final String TAG = "Extract";

生成Log.d()

logd+Tab键:

Log.d(TAG, "onCreate: ");

生成Log.e()

loge+Tab键:

Log.e(TAG, "onCreate: ",new Throwable());

生成Log.i/w类似

Log.i(TAG, "onCreate: ");
Log.w(TAG, "onCreate: ", );

logm+Tab:打印参数

Log.d(TAG, "onCreate() called with: savedInstanceState = [" + savedInstanceState + "]");

logr+Tab:打印返回值

Log.d(TAG, "onCreate() returned: " + );

查看日志输出

在Android Studio Logcat选项卡,中可以选择过滤的级别,来过滤日志输出,比如Verbose、Debug、Error等,上面的选项(如Debug)会包含下面选项(如Error)的日志

标签: android_studio

添加新评论