How do you usually Tag log entries? (android)

后端 未结 13 1581
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-22 21:54

I assume most of you are aware of android.util.Log All logging methods accept \'String tag\' as a first argument.

And my question is How do you usually tag y

13条回答
  •  無奈伤痛
    2020-12-22 22:15

    Go to Android Studio -> preference -> Live Templates -> AndroidLog then select Log.d(TAG, String).

    In Template text replace

    android.util.Log.d(TAG, "$METHOD_NAME$: $content$");

    with

    android.util.Log.d("$className$", "$METHOD_NAME$: $content$");

    Then click Edit variables and enter className() in the Expression column next to the className Name column.

    Now when you type the shortcut logd it will put

    Log.d("CurrentClassName", "currentMethodName: ");
    

    You dont need to define a TAG anymore.

提交回复
热议问题