Use new log system

This commit is contained in:
fkloft
2014-01-05 19:16:46 +01:00
parent b31d973cff
commit 5d674eee40
15 changed files with 84 additions and 50 deletions

View File

@ -46,6 +46,10 @@ public final class Log {
}
}
public static void addReceiver(Log.Receiver receiver) {
RECEIVERS.add(receiver);
}
public static void d(String msg) {
d(DEFAULT_TAG, msg);
}
@ -72,6 +76,10 @@ public final class Log {
d(DEFAULT_TAG, msg, tr);
}
public static void d(Throwable tr) {
d("Unexpected " + tr, tr);
}
public static void e(String msg) {
e(DEFAULT_TAG, msg);
}
@ -98,6 +106,10 @@ public final class Log {
e(DEFAULT_TAG, msg, tr);
}
public static void e(Throwable tr) {
e("Unexpected " + tr, tr);
}
public static void i(String msg) {
i(DEFAULT_TAG, msg);
}
@ -124,6 +136,10 @@ public final class Log {
i(DEFAULT_TAG, msg, tr);
}
public static void i(Throwable tr) {
i("Unexpected " + tr, tr);
}
public static boolean log(ConsoleMessage message) {
String msg = message.sourceId();
Matcher matcher = URL_PATTERN.matcher(msg);
@ -160,6 +176,10 @@ public final class Log {
return android.util.Log.println(priority, tag, msg);
}
public static void removeReceiver(Log.Receiver receiver) {
RECEIVERS.remove(receiver);
}
public static void v(String msg) {
v(DEFAULT_TAG, msg);
}
@ -186,6 +206,10 @@ public final class Log {
v(DEFAULT_TAG, msg, tr);
}
public static void v(Throwable tr) {
v("Unexpected " + tr, tr);
}
public static void w(String msg) {
w(DEFAULT_TAG, msg);
}
@ -212,6 +236,10 @@ public final class Log {
w(DEFAULT_TAG, msg, tr);
}
public static void w(Throwable tr) {
w("Unexpected " + tr, tr);
}
private Log() {
// prevent instantiation
throw new UnsupportedOperationException();
@ -256,12 +284,4 @@ public final class Log {
public static interface Receiver {
void handle(Message message);
}
public static void removeReceiver(Log.Receiver receiver) {
RECEIVERS.remove(receiver);
}
public static void addReceiver(Log.Receiver receiver) {
RECEIVERS.add(receiver);
}
}