如何快速在IntelliJ中输入记录器定义? [英] How to enter logger definition in IntelliJ fast?

查看:135
本文介绍了如何快速在IntelliJ中输入记录器定义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一些实时模板或其他东西,可以将记录器定义添加到类中?

Are there some live template or something, to add logger definition into a class?

在Eclipse中,我有一个模板:

In Eclipse I had a template:

private static final Logger log = LoggerFactory.getLogger(${enclosing_type}.class);

日志支持插件中未看到有关此内容的信息. /p>

Don't see something about this in Log Support plugin.

推荐答案

我正在使用此实时模板:

I am using this live template:

private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger( $CLASSNAME$.class );

转到编辑变量"并将CLASSNAME变量设置为表达式className(),以便IntelliJ自动插入类名.

Go to "Edit variables" and set the CLASSNAME variable to be the expression className() so IntelliJ will automatically insert the class name.

此外,启用缩短FQ名称"复选框,以便IntelliJ使用导入语句.

Further, enable the checkbox 'Shorten FQ names' so IntelliJ will use import statements.

这篇关于如何快速在IntelliJ中输入记录器定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆