thread warning + better logging

This commit is contained in:
marc barbier
2021-07-10 16:57:53 +02:00
parent f726458f29
commit 416f0b892e
2 changed files with 8 additions and 2 deletions
+6 -2
View File
@@ -8,11 +8,15 @@ public class Log {
private static PrintStream lastStream = System.out;
public static void e(String who, String msg) {
printNonStatic(String.valueOf(who) + " : " + msg, System.err);
printNonStatic("[ERROR]" + who + " : " + msg, System.err);
}
public static void w(String who, String msg) {
printNonStatic("[WARN]" + who + " : " + msg, System.out);
}
public static void i(String who, String msg) {
if(Main.verbose) printNonStatic(String.valueOf(who) + " : " + msg, System.out);
if(Main.verbose) printNonStatic("[INFO]" + who + " : " + msg, System.out);
}
private static void printNonStatic(String line, PrintStream stream) {
@@ -45,6 +45,8 @@ public class Main {
String cmd = it.next();
switch (cmd) {
case "-t":
Log.w("main", "Warning using -t option can lead to corruption during download if you have a lot of cores or a slow internet");
if (threadNb != null) {
Log.e("main", "error conflicting arguments --thread and -t");
System.exit(1);