时间格式化工具支持自定义设置单位

This commit is contained in:
Looly 2024-06-17 15:46:11 +08:00
parent 40c2b3ff87
commit d0fdf42dcd

View File

@ -31,10 +31,6 @@ import java.util.function.Function;
public class BetweenFormatter implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 单位格式化器
*/
public static Function<Level, String> DEFAULT_LEVEL_FORMATTER = (level) -> level.name;
/**
* 时长毫秒数
*/
@ -55,7 +51,7 @@ public class BetweenFormatter implements Serializable {
/**
* 格式化器
*/
private Function<Level, String> levelFormatter = DEFAULT_LEVEL_FORMATTER;
private Function<Level, String> levelFormatter = Level::getName;
/**
* 分隔符
*/