Code Monkey home page Code Monkey logo

android-studio-timber-log-templates-for-kotlin's Introduction

Android Studio Timber Log Templates for Kotlin

Android Studio provides 'Live Templates' for inserting recurring code snippets like loops and log statements. For example, hitting TAB when entering logd will produce

    Log.d("divide: foo");

Not all templates are available for Kotlin, yet. To spare you the time of creating them, this repo provides the Kotlin version of the timber log templates.

Download

OR

  • Download templates/AndroidLogKotlin.xml and move it into Android Studio's templates directory (on Windows: C:\Users\John\.AndroidStudio3.1\config\templates)

The templates will be available after restarting Android Studio.

Usage

logd - Timber.d(String)

    Timber.d("divide: foo")

loge - Timber.e(Exception, String)

    Timber.e(e, "divide: foo")

logi - Timber.i(String)

    Timber.i("divide: foo")

logm - Log method name and its arguments

    Timber.d("divide() called with: a = [$a], b = [$b]")

logr - Log result of this method

    Timber.d("divide() returned: $result")

logw - Log.w(Exception, String)

    Timber.w(e, "divide: foo")

wtf - Log.wtf(Exception, String)

    Timber.wtf(e, "divide: foo")

Note: Any changes you've made to the Java log templates will get lost as the 'AndroidLog.xml' file is overwritten. You can prevent this by merging the XML files manually.

The templates will be available after restarting Android Studio.

Modify Templates

One can edit these templates and add new ones in Android Studio under 'Settings > Editor > Live Templates'.

Also, you can restore the built-in templates there if any problems occur after the import.

android-studio-timber-log-templates-for-kotlin's People

Contributors

jdsingh avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.