I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 5a1fc32d authored by str4d's avatar str4d
Browse files

All logging is conditional

parent 7218b796
No related branches found
No related tags found
No related merge requests found
# Required for release # Required for release
- Ensure all logging is conditional
- Prevent accidental shutdown - Prevent accidental shutdown
- Add pop-up confirming router shutdown - Add pop-up confirming router shutdown
- OR: make router button long-press - OR: make router button long-press
......
...@@ -7,7 +7,6 @@ import android.net.ConnectivityManager; ...@@ -7,7 +7,6 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.os.Build; import android.os.Build;
import net.i2p.I2PAppContext; import net.i2p.I2PAppContext;
import net.i2p.util.Log;
public abstract class Util { public abstract class Util {
private static final boolean _isEmulator = Build.MODEL.equals("sdk"); private static final boolean _isEmulator = Build.MODEL.equals("sdk");
...@@ -54,11 +53,13 @@ public abstract class Util { ...@@ -54,11 +53,13 @@ public abstract class Util {
public static void e(String m, Throwable t) { public static void e(String m, Throwable t) {
I2PAppContext ctx = I2PAppContext.getCurrentContext(); I2PAppContext ctx = I2PAppContext.getCurrentContext();
if (ctx != null) if (ctx != null)
ctx.logManager().getLog(Util.class).log(Log.ERROR, m, t); ctx.logManager().getLog(Util.class).error(m, t);
else if (t != null) else if (android.util.Log.isLoggable(ANDROID_TAG, android.util.Log.ERROR)) {
android.util.Log.e(ANDROID_TAG, m + ' ' + t + ' ' + android.util.Log.getStackTraceString(t)); if (t != null)
else android.util.Log.e(ANDROID_TAG, m + ' ' + t + ' ' + android.util.Log.getStackTraceString(t));
android.util.Log.e(ANDROID_TAG, m); else
android.util.Log.e(ANDROID_TAG, m);
}
} }
public static void w(String m) { public static void w(String m) {
...@@ -68,11 +69,13 @@ public abstract class Util { ...@@ -68,11 +69,13 @@ public abstract class Util {
public static void w(String m, Throwable t) { public static void w(String m, Throwable t) {
I2PAppContext ctx = I2PAppContext.getCurrentContext(); I2PAppContext ctx = I2PAppContext.getCurrentContext();
if (ctx != null) if (ctx != null)
ctx.logManager().getLog(Util.class).log(Log.WARN, m, t); ctx.logManager().getLog(Util.class).warn(m, t);
else if (t != null) else if (android.util.Log.isLoggable(ANDROID_TAG, android.util.Log.WARN)) {
android.util.Log.w(ANDROID_TAG, m + ' ' + t + ' ' + android.util.Log.getStackTraceString(t)); if (t != null)
else android.util.Log.w(ANDROID_TAG, m + ' ' + t + ' ' + android.util.Log.getStackTraceString(t));
android.util.Log.w(ANDROID_TAG, m); else
android.util.Log.w(ANDROID_TAG, m);
}
} }
public static void i(String m) { public static void i(String m) {
...@@ -82,11 +85,13 @@ public abstract class Util { ...@@ -82,11 +85,13 @@ public abstract class Util {
public static void i(String m, Throwable t) { public static void i(String m, Throwable t) {
I2PAppContext ctx = I2PAppContext.getCurrentContext(); I2PAppContext ctx = I2PAppContext.getCurrentContext();
if (ctx != null) if (ctx != null)
ctx.logManager().getLog(Util.class).log(Log.INFO, m, t); ctx.logManager().getLog(Util.class).info(m, t);
else if (t != null) else if (android.util.Log.isLoggable(ANDROID_TAG, android.util.Log.INFO)) {
android.util.Log.i(ANDROID_TAG, m + ' ' + t + ' ' + android.util.Log.getStackTraceString(t)); if (t != null)
else android.util.Log.i(ANDROID_TAG, m + ' ' + t + ' ' + android.util.Log.getStackTraceString(t));
android.util.Log.i(ANDROID_TAG, m); else
android.util.Log.i(ANDROID_TAG, m);
}
} }
public static void d(String m) { public static void d(String m) {
d(m, null); d(m, null);
...@@ -95,10 +100,12 @@ public abstract class Util { ...@@ -95,10 +100,12 @@ public abstract class Util {
public static void d(String m, Throwable t) { public static void d(String m, Throwable t) {
I2PAppContext ctx = I2PAppContext.getCurrentContext(); I2PAppContext ctx = I2PAppContext.getCurrentContext();
if (ctx != null) if (ctx != null)
ctx.logManager().getLog(Util.class).log(Log.DEBUG, m, t); ctx.logManager().getLog(Util.class).debug(m, t);
else if (t != null) else if (android.util.Log.isLoggable(ANDROID_TAG, android.util.Log.DEBUG)) {
android.util.Log.d(ANDROID_TAG, m + ' ' + t + ' ' + android.util.Log.getStackTraceString(t)); if (t != null)
else android.util.Log.d(ANDROID_TAG, m + ' ' + t + ' ' + android.util.Log.getStackTraceString(t));
android.util.Log.d(ANDROID_TAG, m); else
android.util.Log.d(ANDROID_TAG, m);
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment