From 048ecdeb3bbb6ebf38c18ede6ede0871e2aaf325 Mon Sep 17 00:00:00 2001 From: "junj2.liang" Date: Fri, 2 Sep 2022 17:02:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/sunyard/sge/log/SydLogger.java | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/sunyard/sge/log/SydLogger.java b/src/main/java/com/sunyard/sge/log/SydLogger.java index 41924e7..19db932 100644 --- a/src/main/java/com/sunyard/sge/log/SydLogger.java +++ b/src/main/java/com/sunyard/sge/log/SydLogger.java @@ -5,17 +5,32 @@ import java.util.concurrent.ConcurrentLinkedQueue; public class SydLogger { private ConcurrentLinkedQueue queue; + SydLogger(ConcurrentLinkedQueue queue) { this.queue = queue; } - public void debug(String msg, Object... params){ - this.queue.add( new LogInfo(3, msg, params) ); + public void debug(String msg, Object... params) { + if (SydLogFactory.iLogLevel == 3) { + this.queue.add(new LogInfo(3, msg, params)); + } else { + return; + } } - public void info(String msg, Object... params){ - this.queue.add( new LogInfo(2, msg, params) ); + + public void info(String msg, Object... params) { + if (SydLogFactory.iLogLevel >= 2) { + this.queue.add(new LogInfo(2, msg, params)); + } else { + return; + } } - public void error(String msg, Object... params){ - this.queue.add( new LogInfo(1, msg, params) ); + + public void error(String msg, Object... params) { + if (SydLogFactory.iLogLevel >= 1) { + this.queue.add(new LogInfo(1, msg, params)); + } else { + return; + } } }