From 31ccf14941168ae83ddf5c22c33161bb19c80c26 Mon Sep 17 00:00:00 2001 From: Eyre_S Date: Mon, 13 Dec 2021 22:57:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=84=8F=E5=A4=96=E7=BC=BA?= =?UTF-8?q?=E5=B0=91=E7=9A=84=20LogLevel.DEBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- src/main/java/cc/sukazyo/messiva/Logger.java | 7 ++++++- .../cc/sukazyo/messiva/log/ILogLevelImpl.java | 17 +++++++++++++++++ .../java/cc/sukazyo/messiva/log/LogLevel.java | 1 + 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 src/main/java/cc/sukazyo/messiva/log/ILogLevelImpl.java diff --git a/gradle.properties b/gradle.properties index 1b0292d..4dc4de0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ ## Messiva -PROJECT_VERSION = 0.1.0.0 +PROJECT_VERSION = 0.1.0.1 ## dependencies diff --git a/src/main/java/cc/sukazyo/messiva/Logger.java b/src/main/java/cc/sukazyo/messiva/Logger.java index 9230cd9..ab406b5 100644 --- a/src/main/java/cc/sukazyo/messiva/Logger.java +++ b/src/main/java/cc/sukazyo/messiva/Logger.java @@ -1,6 +1,7 @@ package cc.sukazyo.messiva; import cc.sukazyo.messiva.appender.IAppender; +import cc.sukazyo.messiva.log.ILogLevelImpl; import cc.sukazyo.messiva.log.Log; import cc.sukazyo.messiva.log.LogLevel; import cc.sukazyo.messiva.log.Message; @@ -9,7 +10,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class Logger { +public class Logger implements ILogLevelImpl { public final List appends = new ArrayList<>(); @@ -23,6 +24,10 @@ public class Logger { pushToAllAppender(new Log(1, new Message(message), LogLevel.TRACE)); } + public void debug (String message) { + pushToAllAppender(new Log(1, new Message(message), LogLevel.DEBUG)); + } + public void info (String message) { pushToAllAppender(new Log(1, new Message(message), LogLevel.INFO)); } diff --git a/src/main/java/cc/sukazyo/messiva/log/ILogLevelImpl.java b/src/main/java/cc/sukazyo/messiva/log/ILogLevelImpl.java new file mode 100644 index 0000000..7921b26 --- /dev/null +++ b/src/main/java/cc/sukazyo/messiva/log/ILogLevelImpl.java @@ -0,0 +1,17 @@ +package cc.sukazyo.messiva.log; + +public interface ILogLevelImpl { + + void trace (String message); + + void debug (String message); + + void info (String message); + + void warn (String message); + + void error (String message); + + void fatal (String message); + +} diff --git a/src/main/java/cc/sukazyo/messiva/log/LogLevel.java b/src/main/java/cc/sukazyo/messiva/log/LogLevel.java index 0fe063c..bbdf42a 100644 --- a/src/main/java/cc/sukazyo/messiva/log/LogLevel.java +++ b/src/main/java/cc/sukazyo/messiva/log/LogLevel.java @@ -3,6 +3,7 @@ package cc.sukazyo.messiva.log; public enum LogLevel { TRACE(-1f, "TRAC"), + DEBUG(-0.1f, "DBUG"), INFO(0f, "INFO"), WARN(0.5f, "WARN"), ERROR(1f, "ERRO"),