add tinylog2 support

This commit is contained in:
Looly
2020-09-18 15:19:05 +08:00
parent fd5f43b5b1
commit c205e7383d
8 changed files with 242 additions and 6 deletions

View File

@@ -1,7 +1,5 @@
package cn.hutool.log.test;
import org.junit.Test;
import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import cn.hutool.log.dialect.commons.ApacheCommonsLogFactory;
@@ -11,7 +9,9 @@ import cn.hutool.log.dialect.jdk.JdkLogFactory;
import cn.hutool.log.dialect.log4j.Log4jLogFactory;
import cn.hutool.log.dialect.log4j2.Log4j2LogFactory;
import cn.hutool.log.dialect.slf4j.Slf4jLogFactory;
import cn.hutool.log.dialect.tinylog.TinyLog2Factory;
import cn.hutool.log.dialect.tinylog.TinyLogFactory;
import org.junit.Test;
/**
* 日志门面单元测试
@@ -62,6 +62,17 @@ public class CustomLogTest {
log.info((String)null);
log.info("This is custom '{}' log\n{}", factory.getName(), LINE);
}
@Test
public void tinyLog2Test(){
LogFactory factory = new TinyLog2Factory();
LogFactory.setCurrentLogFactory(factory);
Log log = LogFactory.get();
log.info(null);
log.info((String)null);
log.info("This is custom '{}' log\n{}", factory.getName(), LINE);
}
@Test
public void log4j2LogTest(){

View File

@@ -5,7 +5,9 @@
# \u65e5\u5fd7\u5199\u51fa\u65b9\u5f0f\uff1a[console] [file] [jdbc] [logcat] [rollingfile] [sharedfile] [null]
tinylog.writer = console
writer = console
# \u65e5\u5fd7\u5199\u51fa\u7ea7\u522b\uff1aTRACE < DEBUG < INFO < WARNING < ERROR < OFF
tinylog.level = debug
# \u65e5\u5fd7\u6253\u5370\u683c\u5f0f
tinylog.format = [{date:HH:mm:ss}][{level}] {class}:{line} - {message}
tinylog.format = [{date:HH:mm:ss}][{level}] {class}:{line} - {message}
writer.format = [{date:HH:mm:ss}][{level}] {class}:{line} - {message}