新增类SpringBoot的彩色日志输出风格
This commit is contained in:
李鸿达
2022-04-27 10:23:44 +08:00
committed by Topcoder2023
parent bb07763366
commit 1c3f98f889
3 changed files with 238 additions and 0 deletions

View File

@@ -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");
}
}