|
|
@@ -38,7 +38,7 @@ public abstract class APIModule<T extends RequestBean, R extends LifeplusAPIBean
|
|
|
|
|
|
@Override
|
|
|
public void accept(R resultBean) throws Exception {
|
|
|
- Log.i("APP# APIModule | accept", "| " + APIModule.this.getClass().getSimpleName() + " <- " + resultBean.toJson());
|
|
|
+ trace(resultBean.toJson());
|
|
|
if (resultBean.isSuccess()) {
|
|
|
listener.onApiSuccess(resultBean);
|
|
|
}
|
|
|
@@ -46,6 +46,30 @@ public abstract class APIModule<T extends RequestBean, R extends LifeplusAPIBean
|
|
|
listener.onApiReason(resultBean);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void trace(String str) {
|
|
|
+
|
|
|
+ int limit = 3000;
|
|
|
+ if (str.length() > limit) {
|
|
|
+ Log.d("APP# APIModule | trace", "| " + APIModule.this.getClass().getSimpleName() + " <- length = " + str.length());
|
|
|
+ int chunkCount = str.length() / limit; // integer division
|
|
|
+ for (int i = 0; i <= chunkCount; i++) {
|
|
|
+ int max = limit * (i + 1);
|
|
|
+ if (max >= str.length()) {
|
|
|
+ Log.d("APP# APIModule | trace", "| <- " + str.substring(limit * i));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ Log.d("APP# APIModule | trace", "| <- " + str.substring(limit * i, max));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ Log.i("APP# APIModule | accept", "| " + APIModule.this.getClass().getSimpleName() + " <- " + str);
|
|
|
+ }
|
|
|
+
|
|
|
+ // http://stackoverflow.com/questions/8888654/android-set-max-length-of-logcat-messages
|
|
|
}
|
|
|
|
|
|
// error
|