Add colorization in System.err logs (#83)

Add colorization in System.err logs
Errors are reds, Warnings are yellow, Infos are green

Co-authored-by: Louis <louis.royer@univ-tlse3.fr>
pull/85/head
Louis Royer 5 years ago
parent 07cecf2fab
commit 15e1bd2e75

@ -34,17 +34,21 @@ public class Logger {
* @param text Text to log
*/
public void write(String text, LogLevel logLevel) {
String colorize = "\u001B[0";
String msg = "[" + new Timestamp(System.currentTimeMillis()) + "] " + text + "\n";
String level = null;
switch (logLevel) {
case Error:
level = "[Error]";
colorize = "\u001B[31m"; // RED
break;
case Info:
level = "[Info]";
colorize = "\u001B[32m"; // GREEN
break;
case Warning:
level = "[Warning]";
colorize = "\u001B[33m"; // YELLOW
break;
case Action:
level = "[Action]";
@ -64,7 +68,7 @@ public class Logger {
case Warning:
case Debug:
default:
System.err.println(text);
System.err.println(colorize + text + "\u001B[0m");
break;
case Action:
break;

@ -6,7 +6,7 @@ package tools;
* @author JS Auge
* @version 1.0
*/
public class PortRange {
public abstract class PortRange {
protected int portMax;
protected int portMin;
@ -34,7 +34,7 @@ public class PortRange {
}
/** To String
* @return String representation
* @return String representation
*/
public String toString() {
return "default " + type + "port: " + defaultPort + "(range: " + portMin + " -> " + portMax + ")";

Loading…
Cancel
Save