LiangliangSui commented on code in PR #1485:
URL: https://github.com/apache/incubator-fury/pull/1485#discussion_r1557659445


##########
java/fury-core/src/main/java/org/apache/fury/logging/FuryLogger.java:
##########
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.fury.logging;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+public class FuryLogger implements Logger {
+  private static final DateTimeFormatter dateTimeFormatter =
+      DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss");
+  private final String name;
+
+  public FuryLogger(Class<?> targetClass) {
+    this.name = targetClass.getSimpleName();
+  }
+
+  // The implementation should not forward to other method, otherwise the 
fileNumber won't be right.
+  @Override
+  public void info(String msg) {
+    log("INFO", msg, new Object[0], false);
+  }
+
+  @Override
+  public void info(String msg, Object arg) {
+    log("INFO", msg, new Object[] {arg}, false);
+  }
+
+  @Override
+  public void info(String msg, Object arg1, Object arg2) {
+    log("INFO", msg, new Object[] {arg1, arg2}, false);
+  }
+
+  @Override
+  public void info(String msg, Object... args) {
+    log("INFO", msg, args, false);
+  }
+
+  @Override
+  public void warn(String msg) {
+    log("WARN", msg, new Object[0], false);
+  }
+
+  @Override
+  public void warn(String msg, Object arg) {
+    log("WARN", msg, new Object[] {arg}, true);
+  }
+
+  @Override
+  public void warn(String msg, Object arg1, Object arg2) {
+    log("WARN", msg, new Object[] {arg1, arg2}, true);
+  }
+
+  @Override
+  public void warn(String msg, Object... args) {
+    log("WARN", msg, args, true);
+  }
+
+  @Override
+  public void warn(String msg, Throwable t) {
+    log("WARN", msg, new Object[] {t}, true);
+  }
+
+  @Override
+  public void error(String msg) {
+    log("ERROR", msg, new Object[0], false);
+  }
+
+  @Override
+  public void error(String msg, Object arg) {
+    log("ERROR", msg, new Object[] {arg}, true);
+  }
+
+  @Override
+  public void error(String msg, Object arg1, Object arg2) {
+    log("ERROR", msg, new Object[] {arg1, arg2}, true);
+  }
+
+  @Override
+  public void error(String msg, Object... args) {
+    log("ERROR", msg, args, true);
+  }
+
+  @Override
+  public void error(String msg, Throwable t) {
+    log("ERROR", msg, new Object[] {t}, true);
+  }
+
+  private void log(String level, String msg, Object[] args, boolean 
mayPrintTrace) {

Review Comment:
   Could we replace `String level` with a `Level enum`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@fury.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@fury.apache.org
For additional commands, e-mail: commits-h...@fury.apache.org

Reply via email to