Permalink
Browse files

Allow customizing the Android log identifier.

  • Loading branch information...
1 parent 0874ed3 commit c59a70f987597e0f1aca934c22af52bacd984a5f @samskivert samskivert committed Jan 9, 2013
@@ -21,13 +21,19 @@
class AndroidLog extends LogImpl {
+ private final String logIdent;
+
+ public AndroidLog(GameActivity activity) {
+ this.logIdent = activity.logIdent();
+ }
+
@Override
protected void logImpl(Level level, String msg, Throwable e) {
switch (level) {
- case DEBUG: Log.d("playn", msg, e); break;
- default: Log.i("playn", msg, e); break;
- case WARN: Log.w("playn", msg, e); break;
- case ERROR: Log.e("playn", msg, e); break;
+ case DEBUG: Log.d(logIdent, msg, e); break;
+ default: Log.i(logIdent, msg, e); break;
+ case WARN: Log.w(logIdent, msg, e); break;
+ case ERROR: Log.e(logIdent, msg, e); break;
}
}
}
@@ -49,7 +49,7 @@
private final Json json;
protected AndroidPlatform(GameActivity activity, AndroidGL20 gl20) {
- super(new AndroidLog());
+ super(new AndroidLog(activity));
this.activity = activity;
audio = new AndroidAudio(this);
@@ -184,6 +184,13 @@ protected String prefsName() {
}
/**
+ * Returns the identifier to use for log messages. Defaults to {@code playn}.
+ */
+ protected String logIdent() {
+ return "playn";
+ }
+
+ /**
* Returns the configuration that will be used to decode bitmaps. The default implementation uses
* {@code ARGB_8888} unless the device memory class is 16MB or less or the device screen is
* itself {@code ARGB_4444}. NOTE: this is called once during platform initialization and the
@@ -48,7 +48,7 @@
* {@code level} will be suppressed. Note that all messages are still passed to any registered
* {@link Collector}, but suppressed messages are not sent to the platform logging system.
*/
- void setMinLevel (Level level);
+ void setMinLevel(Level level);
/**
* An debug message.

0 comments on commit c59a70f

Please sign in to comment.