Android Studio
's Live templates
can offer quite a few shortcuts for quick logging.
To use Live templates, all you need to do is to start typing the template name, and hit TAB
or enter to insert the statement.
Examples:
logi
→ turns into → android.util.Log.i(TAG, "$METHOD_NAME$: $content$");
$METHOD_NAME$
will automatically be replaced with your method name, and the cursor will wait for the content to be filled.loge
→ same, for errorFull list of templates can be found in Android Studio
's settings (ALT+s and type "live"). And it is possible to add your custom templates as well.
If you find Android Studio
's Live templates
not enough for your needs,
you can consider Android Postfix Plugin
This is a very useful library which helps you to avoid writing the logging line manually.
The syntax is absolutely simple:
.log - Logging. If there is constant variable "TAG", it use "TAG" . Else it use class name.