| 1 | package exitcode; |
| 2 | |
| 3 | public class Logger { |
| 4 | |
| 5 | public static void printSystemInfo() { |
| 6 | Logger.messageCustom("INFO", ""); |
| 7 | Logger.messageCustom("INFO", |
| 8 | String.format("OS: %s, Version: %s, Arch: %s | Java: %s, JRE: %s", |
| 9 | System.getProperty("os.name"), |
| 10 | System.getProperty("os.version"), |
| 11 | System.getProperty("os.arch"), |
| 12 | System.getProperty("java.version"), |
| 13 | System.getProperty("java.runtime.version") |
| 14 | ) |
| 15 | ); |
| 16 | Logger.messageCustom("INFO", ""); |
| 17 | } |
| 18 | |
| 19 | public static void message(String message) { |
| 20 | System.out.println(String.format("[OUTPUT] %s", message)); |
| 21 | } |
| 22 | |
| 23 | public static void warn(String warningMessage) { |
| 24 | System.err.println(String.format("[WARNING] %s", warningMessage)); |
| 25 | } |
| 26 | |
| 27 | public static void error(String errorMessage) { |
| 28 | System.err.println(String.format("[ERROR] %s", errorMessage)); |
| 29 | } |
| 30 | |
| 31 | public static void messageCustom(String messageTitle, String message) { |
| 32 | System.out.println(String.format("[%s] %s", messageTitle, message)); |
| 33 | } |
| 34 | |
| 35 | public static void errorCustom(String errorTitle, String errorMessage) { |
| 36 | System.err.println(String.format("[%s] %s", errorTitle, errorMessage)); |
| 37 | } |
| 38 | |
| 39 | public static void debug(String debugText) { |
| 40 | int callersLineNumber = Thread.currentThread().getStackTrace()[2].getLineNumber(); |
| 41 | String callersClassName = Thread.currentThread().getStackTrace()[2].getClassName(); |
| 42 | System.err.println(String.format("[DEBUG: %s:%s] %s", callersClassName, callersLineNumber, debugText)); |
| 43 | } |
| 44 | } |
nothing calls this directly
no outgoing calls
no test coverage detected