Update logging to be size-limited and more performant.

This commit is contained in:
Greyson Parrelli
2021-07-23 07:39:16 -04:00
parent 3c748b2df6
commit 15a5f5966d
18 changed files with 253 additions and 167 deletions

View File

@@ -3,24 +3,20 @@ package org.thoughtcrime.securesms.testutil;
import org.signal.core.util.logging.Log;
public class EmptyLogger extends Log.Logger {
public EmptyLogger() {
super(0);
}
@Override
public void v(String tag, String message, Throwable t, boolean keepLonger) { }
@Override
public void v(String tag, String message, Throwable t, long duration) { }
public void d(String tag, String message, Throwable t, boolean keepLonger) { }
@Override
public void d(String tag, String message, Throwable t, long duration) { }
public void i(String tag, String message, Throwable t, boolean keepLonger) { }
@Override
public void i(String tag, String message, Throwable t, long duration) { }
public void w(String tag, String message, Throwable t, boolean keepLonger) { }
@Override
public void w(String tag, String message, Throwable t, long duration) { }
@Override
public void e(String tag, String message, Throwable t, long duration) { }
public void e(String tag, String message, Throwable t, boolean keepLonger) { }
@Override
public void flush() { }

View File

@@ -17,32 +17,28 @@ public final class LogRecorder extends Log.Logger {
private final List<Entry> errors = new ArrayList<>();
private final List<Entry> wtf = new ArrayList<>();
public LogRecorder() {
super(0);
}
@Override
public void v(String tag, String message, Throwable t, long duration) {
public void v(String tag, String message, Throwable t, boolean keepLonger) {
verbose.add(new Entry(tag, message, t));
}
@Override
public void d(String tag, String message, Throwable t, long duration) {
public void d(String tag, String message, Throwable t, boolean keepLonger) {
debug.add(new Entry(tag, message, t));
}
@Override
public void i(String tag, String message, Throwable t, long duration) {
public void i(String tag, String message, Throwable t, boolean keepLonger) {
information.add(new Entry(tag, message, t));
}
@Override
public void w(String tag, String message, Throwable t, long duration) {
public void w(String tag, String message, Throwable t, boolean keepLonger) {
warnings.add(new Entry(tag, message, t));
}
@Override
public void e(String tag, String message, Throwable t, long duration) {
public void e(String tag, String message, Throwable t, boolean keepLonger) {
errors.add(new Entry(tag, message, t));
}

View File

@@ -3,32 +3,28 @@ package org.thoughtcrime.securesms.testutil;
import org.signal.core.util.logging.Log;
public final class SystemOutLogger extends Log.Logger {
public SystemOutLogger() {
super(0);
}
@Override
public void v(String tag, String message, Throwable t, long duration) {
public void v(String tag, String message, Throwable t, boolean keepLonger) {
printlnFormatted('v', tag, message, t);
}
@Override
public void d(String tag, String message, Throwable t, long duration) {
public void d(String tag, String message, Throwable t, boolean keepLonger) {
printlnFormatted('d', tag, message, t);
}
@Override
public void i(String tag, String message, Throwable t, long duration) {
public void i(String tag, String message, Throwable t, boolean keepLonger) {
printlnFormatted('i', tag, message, t);
}
@Override
public void w(String tag, String message, Throwable t, long duration) {
public void w(String tag, String message, Throwable t, boolean keepLonger) {
printlnFormatted('w', tag, message, t);
}
@Override
public void e(String tag, String message, Throwable t, long duration) {
public void e(String tag, String message, Throwable t, boolean keepLonger) {
printlnFormatted('e', tag, message, t);
}