simplified crash logging method

master
Stefan Dollase 2016-11-21 02:18:31 +01:00
parent ada76a3e4c
commit 38f367327d
5 changed files with 8 additions and 14 deletions

View File

@ -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);
}
}
}
}

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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);
}