希望你使用过Android默认提供的Live模板.

Like:

Generate debug log statement: "logd"+TAB
Generate error log statement: "loge"+TAB
Generate info log statement: "logi"+TAB
Generate TAG declaration: "logt"+TAB
Generate parameter logging: "logm"+TAB
Generate method return log: "logr"+TAB

enter image description here

Which it is not available in KOTLIN?

Android Studio 3.0 Canary Version美元没有吗?

推荐答案

Yet not added log template in Kotlin Live templates section in Android Studio.

Settings -> Editor -> Live Templates -> Kotlin for kotlin templates.

kotlin templates

Settings -> Editor -> Live Templates -> AndroidLog for AndroidLog templates

AndroidLog  templates.

So you can't get the same AndroidLog templates in Kotlin code.

所以现在Question等于How to use same Log Functions using templates in Kotlin

Ans:您可以在Android直播间的Kotlin Templates section中添加相同的日志(log)模板(AndroidLog模板),如下例所示.

Kotlin Templates section

Then It will be available in your Kotlin code!

Kotlin loge

我希望通过这种方式,您可以利用Kotlin中的日志(log)函数模板.

Kotlin相关问答推荐

在Kotlin中可以连接两个范围吗?

Kotlin中的增广赋值语句中的难以理解的错误

升级使用jOOQ Gradle插件生成代码失败

Spring Boot 3:为Kotlin中的TestRestTemplate配置读取超时

在 Kotlin 中,为什么我们要在闭包中捕获值

扩展属性委托给实例属性

Kotlin 如何使用其 get 函数在内部检索映射值

使用事务时未调用 Kafka ConsumerInterceptor onCommit

is return inside function definition 也是 kotlin 中的表达式

Kotlin 代码是如何编译成原生代码的?

如何禁用智能投射突出显示 Kotlin?

Kotlin 中的部分类委托

Kotlin 语言是如何用 Kotlin 编写的?

如何在 Kotlin 中判断数组类型(不是泛型类型)

片段内的 Kotlin 按钮 onClickListener 事件

Kotlin中保留的关键字是什么?

Failure delivering result on activity result

Kotlin类型安全类型别名

在Kotlin中创建通用二维数组

从另一个列表创建一个列表