You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.0 KiB
37 lines
1.0 KiB
package client.log;
|
|
|
|
import java.io.PrintStream;
|
|
|
|
public class EventLogger {
|
|
|
|
private static final String ANSI_RESET = "\u001B[0m";
|
|
private static final String ANSI_RED = "\u001B[31m";
|
|
private static final String ANSI_GREEN = "\u001B[32m";
|
|
private static final String ANSI_BLUE = "\u001B[34m";
|
|
private static final String ANSI_WHITE = "\u001B[37m";
|
|
private final PrintStream stream;
|
|
|
|
public EventLogger(PrintStream stream) {
|
|
this.stream = stream;
|
|
}
|
|
|
|
public void println(String msg) {
|
|
stream.println(msg);
|
|
}
|
|
|
|
public void error(String msg) {
|
|
stream.println(ANSI_WHITE + "[" + ANSI_RED + "-" + ANSI_WHITE + "] " + msg + ANSI_RESET);
|
|
}
|
|
|
|
public void info(String msg) {
|
|
stream.println(ANSI_WHITE + "[" + ANSI_BLUE + "*" + ANSI_WHITE + "] " + msg + ANSI_RESET);
|
|
}
|
|
|
|
public void success(String msg) {
|
|
stream.println(ANSI_WHITE + "[" + ANSI_GREEN + "+" + ANSI_WHITE + "] " + msg + ANSI_RESET);
|
|
}
|
|
|
|
public void close() {
|
|
stream.close();
|
|
}
|
|
}
|