Skip to content

Commit

Permalink
don't hide errors behind the debug flag
Browse files Browse the repository at this point in the history
  • Loading branch information
BLuFeNiX committed Jul 9, 2021
1 parent fcdb2e6 commit e884ac4
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/main/java/net/blufenix/common/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ public static void d(String format, Object... args) {
}

public static void e(String format, Object... args) {
if (Config.debug) {
int lastIdx = args.length-1;
if (args.length > 0 && args[lastIdx] instanceof Throwable) {
Object[] tmpArgs = new Object[lastIdx];
System.arraycopy(args, 0, tmpArgs, 0, lastIdx);
LazyHolder.logger.warning(String.format(format, tmpArgs));
LazyHolder.logger.warning("ERROR: "+((Throwable)args[lastIdx]).getMessage());
((Throwable)args[lastIdx]).printStackTrace();
} else {
LazyHolder.logger.warning(String.format(format, args));
}
int lastIdx = args.length-1;
if (args.length > 0 && args[lastIdx] instanceof Throwable) {
Object[] tmpArgs = new Object[lastIdx];
System.arraycopy(args, 0, tmpArgs, 0, lastIdx);
LazyHolder.logger.warning(String.format(format, tmpArgs));
LazyHolder.logger.warning("ERROR: "+((Throwable)args[lastIdx]).getMessage());
((Throwable)args[lastIdx]).printStackTrace();
} else {
LazyHolder.logger.warning(String.format(format, args));
}
}

Expand Down

0 comments on commit e884ac4

Please sign in to comment.