simplified crash logging method
parent
ada76a3e4c
commit
38f367327d
|
@ -81,7 +81,10 @@ public class AmidstLogger {
|
|||
synchronized (LOG_LOCK) {
|
||||
String exceptionText = MessageFormatter.format(e);
|
||||
for (Logger listener : LOGGER.values()) {
|
||||
listener.crash(e, exceptionText, message);
|
||||
listener.crash(message);
|
||||
if (e != null) {
|
||||
listener.crash(exceptionText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,11 +25,8 @@ public class ConsoleLogger implements Logger {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void crash(Throwable e, String exceptionText, String message) {
|
||||
public void crash(String message) {
|
||||
printWithTag("crash", message);
|
||||
if (!exceptionText.isEmpty()) {
|
||||
printWithTag("crash", exceptionText);
|
||||
}
|
||||
}
|
||||
|
||||
private void printWithTag(String tag, String message) {
|
||||
|
|
|
@ -143,11 +143,8 @@ public class FileLogger implements Logger {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void crash(Throwable e, String exceptionText, String message) {
|
||||
public void crash(String message) {
|
||||
write("crash", message);
|
||||
if (!exceptionText.isEmpty()) {
|
||||
write("crash", exceptionText);
|
||||
}
|
||||
}
|
||||
|
||||
private void write(String tag, String message) {
|
||||
|
|
|
@ -27,11 +27,8 @@ public class InMemoryLogger implements Logger {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void crash(Throwable e, String exceptionText, String message) {
|
||||
public void crash(String message) {
|
||||
write("crash", message);
|
||||
if (!exceptionText.isEmpty()) {
|
||||
write("crash", exceptionText);
|
||||
}
|
||||
}
|
||||
|
||||
private void write(String tag, String message) {
|
||||
|
|
|
@ -9,5 +9,5 @@ public interface Logger {
|
|||
|
||||
public void error(String messages);
|
||||
|
||||
public void crash(Throwable e, String exceptionText, String message);
|
||||
public void crash(String message);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue