mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add static get for Log
This commit is contained in:
parent
9fa28dcb71
commit
4c625e582a
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
### 新特性
|
### 新特性
|
||||||
* 【all】 升级JDK最低 支持到8
|
* 【all】 升级JDK最低 支持到8
|
||||||
|
* 【log】 Log接口添加get的static方法
|
||||||
|
|
||||||
### Bug修复
|
### Bug修复
|
||||||
* 【http】 修复Cookie中host失效导致的问题(issue#583@Github)
|
* 【http】 修复Cookie中host失效导致的问题(issue#583@Github)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.hutool.log;
|
package cn.hutool.log;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.caller.CallerUtil;
|
||||||
import cn.hutool.log.level.DebugLog;
|
import cn.hutool.log.level.DebugLog;
|
||||||
import cn.hutool.log.level.ErrorLog;
|
import cn.hutool.log.level.ErrorLog;
|
||||||
import cn.hutool.log.level.InfoLog;
|
import cn.hutool.log.level.InfoLog;
|
||||||
@ -15,6 +16,37 @@ import cn.hutool.log.level.WarnLog;
|
|||||||
*/
|
*/
|
||||||
public interface Log extends TraceLog, DebugLog, InfoLog, WarnLog, ErrorLog {
|
public interface Log extends TraceLog, DebugLog, InfoLog, WarnLog, ErrorLog {
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------ Static method start
|
||||||
|
/**
|
||||||
|
* 获得Log
|
||||||
|
*
|
||||||
|
* @param clazz 日志发出的类
|
||||||
|
* @return Log
|
||||||
|
*/
|
||||||
|
static Log get(Class<?> clazz) {
|
||||||
|
return LogFactory.get(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得Log
|
||||||
|
*
|
||||||
|
* @param name 自定义的日志发出者名称
|
||||||
|
* @return Log
|
||||||
|
* @since 5.0.0
|
||||||
|
*/
|
||||||
|
public static Log get(String name) {
|
||||||
|
return LogFactory.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return 获得日志,自动判定日志发出者
|
||||||
|
* @since 5.0.0
|
||||||
|
*/
|
||||||
|
static Log get() {
|
||||||
|
return LogFactory.get(CallerUtil.getCallerCaller());
|
||||||
|
}
|
||||||
|
//------------------------------------------------------------------------ Static method start
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return 日志对象的Name
|
* @return 日志对象的Name
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user