forked from TheCyaniteProject/exit_code_java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogger.java
More file actions
44 lines (36 loc) · 1.6 KB
/
Copy pathLogger.java
File metadata and controls
44 lines (36 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package exitcode;
public class Logger {
public static void printSystemInfo() {
Logger.messageCustom("INFO", "");
Logger.messageCustom("INFO",
String.format("OS: %s, Version: %s, Arch: %s | Java: %s, JRE: %s",
System.getProperty("os.name"),
System.getProperty("os.version"),
System.getProperty("os.arch"),
System.getProperty("java.version"),
System.getProperty("java.runtime.version")
)
);
Logger.messageCustom("INFO", "");
}
public static void message(String message) {
System.out.println(String.format("[OUTPUT] %s", message));
}
public static void warn(String warningMessage) {
System.err.println(String.format("[WARNING] %s", warningMessage));
}
public static void error(String errorMessage) {
System.err.println(String.format("[ERROR] %s", errorMessage));
}
public static void messageCustom(String messageTitle, String message) {
System.out.println(String.format("[%s] %s", messageTitle, message));
}
public static void errorCustom(String errorTitle, String errorMessage) {
System.err.println(String.format("[%s] %s", errorTitle, errorMessage));
}
public static void debug(String debugText) {
int callersLineNumber = Thread.currentThread().getStackTrace()[2].getLineNumber();
String callersClassName = Thread.currentThread().getStackTrace()[2].getClassName();
System.err.println(String.format("[DEBUG: %s:%s] %s", callersClassName, callersLineNumber, debugText));
}
}