Skip to content

Commit

Permalink
Optimize logging in LogUtil without string format
Browse files Browse the repository at this point in the history
  • Loading branch information
junkaixue committed Aug 9, 2024
1 parent bb29cec commit 591f70b
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,34 @@

public class LogUtil {
public static void logInfo(Logger logger, String eventInfo, String message) {
logger.info(String.format("Event %s : %s", eventInfo, message));
logger.info("Event {} : {}", eventInfo, message);
}

public static void logWarn(Logger logger, String eventInfo, String message) {
logger.warn(String.format("Event %s : %s", eventInfo, message));
logger.warn("Event {} : {}", eventInfo, message);
}

public static void logError(Logger logger, String eventInfo, String message) {
logger.error(String.format("Event %s : %s", eventInfo, message));
logger.error("Event {} : {}", eventInfo, message);
}

public static void logDebug(Logger logger, String eventInfo, String message) {
logger.debug(String.format("Event %s : %s", eventInfo, message));
logger.debug("Event {} : {}", eventInfo, message);
}

public static void logInfo(Logger logger, String eventInfo, String message, Exception e) {
logger.info(String.format("Event %s : %s", eventInfo, message), e);
logger.info("Event {} :{}", eventInfo, message, e);
}

public static void logWarn(Logger logger, String eventInfo, String message, Exception e) {
logger.warn(String.format("Event %s : %s", eventInfo, message), e);
logger.warn("Event {} :{}", eventInfo, message, e);
}

public static void logError(Logger logger, String eventInfo, String message, Exception e) {
logger.error(String.format("Event %s : %s", eventInfo, message), e);
logger.error("Event {} :{}", eventInfo, message, e);
}

public static void logDebug(Logger logger, String eventInfo, String message, Exception e) {
logger.debug(String.format("Event %s : %s", eventInfo, message), e);
logger.debug("Event {} :{}", eventInfo, message, e);
}
}

0 comments on commit 591f70b

Please sign in to comment.