mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
新增类SpringBoot的彩色日志输出风格
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
package cn.hutool.log.test;
|
||||
|
||||
import cn.hutool.log.LogFactory;
|
||||
import cn.hutool.log.dialect.console.ConsoleColorLog;
|
||||
import cn.hutool.log.dialect.console.ConsoleColorLogFactory;
|
||||
import cn.hutool.log.dialect.console.ConsoleLogFactory;
|
||||
import org.junit.Test;
|
||||
|
||||
import cn.hutool.log.StaticLog;
|
||||
@@ -7,7 +11,20 @@ import cn.hutool.log.StaticLog;
|
||||
public class StaticLogTest {
|
||||
@Test
|
||||
public void test() {
|
||||
LogFactory.setCurrentLogFactory(ConsoleLogFactory.class);
|
||||
StaticLog.debug("This is static {} log", "debug");
|
||||
StaticLog.info("This is static {} log", "info");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void colorTest(){
|
||||
LogFactory.setCurrentLogFactory(ConsoleColorLogFactory.class);
|
||||
StaticLog.debug("This is static {} log", "debug");
|
||||
StaticLog.info("This is static {} log", "info");
|
||||
StaticLog.error("This is static {} log", "error");
|
||||
StaticLog.warn("This is static {} log", "warn");
|
||||
StaticLog.trace("This is static {} log", "trace");
|
||||
ConsoleColorLog.setWarnColor(31);
|
||||
StaticLog.warn("This is static {} log", "warn");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user