| 28 | import java.time.format.DateTimeFormatter; |
| 29 | |
| 30 | public class ForyLogger implements Logger { |
| 31 | private static final DateTimeFormatter dateTimeFormatter = |
| 32 | DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| 33 | private final String name; |
| 34 | |
| 35 | public ForyLogger(Class<?> targetClass) { |
| 36 | this.name = targetClass.getSimpleName(); |
| 37 | } |
| 38 | |
| 39 | // The implementation should not forward to other method, otherwise the fileNumber won't be right. |
| 40 | @Override |
| 41 | public void debug(String msg) { |
| 42 | if (LoggerFactory.getLogLevel() >= DEBUG_LEVEL) { |
| 43 | log(DEBUG_LEVEL, msg, new Object[0], false); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | @Override |
| 48 | public void debug(String msg, Object arg) { |
| 49 | if (LoggerFactory.getLogLevel() >= DEBUG_LEVEL) { |
| 50 | log(DEBUG_LEVEL, msg, new Object[] {arg}, false); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | public void debug(String msg, Object arg1, Object arg2) { |
| 56 | if (LoggerFactory.getLogLevel() >= DEBUG_LEVEL) { |
| 57 | log(DEBUG_LEVEL, msg, new Object[] {arg1, arg2}, false); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | @Override |
| 62 | public void debug(String msg, Object... args) { |
| 63 | if (LoggerFactory.getLogLevel() >= DEBUG_LEVEL) { |
| 64 | log(DEBUG_LEVEL, msg, args, false); |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | @Override |
| 69 | public void info(String msg) { |
| 70 | if (LoggerFactory.getLogLevel() >= INFO_LEVEL) { |
| 71 | log(INFO_LEVEL, msg, new Object[0], false); |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | @Override |
| 76 | public void info(String msg, Object arg) { |
| 77 | if (LoggerFactory.getLogLevel() >= INFO_LEVEL) { |
| 78 | log(INFO_LEVEL, msg, new Object[] {arg}, false); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | @Override |
| 83 | public void info(String msg, Object arg1, Object arg2) { |
| 84 | if (LoggerFactory.getLogLevel() >= INFO_LEVEL) { |
| 85 | log(INFO_LEVEL, msg, new Object[] {arg1, arg2}, false); |
| 86 | } |
| 87 | } |
nothing calls this directly
no outgoing calls
no test coverage detected