|
48 | 48 | public abstract class AbstractParser<T> implements Parser<T>, ParserCreator<T>, VerifierCreator<T>, SQLCreator {
|
49 | 49 | protected static final String TAG = "AbstractParser";
|
50 | 50 |
|
| 51 | + /** |
| 52 | + * 可以通过切换该变量来控制是否打印关键的接口请求内容。保守起见,该值默认为false。 |
| 53 | + * 与 {@link Log#DEBUG} 任何一个为 true 都会打印关键的接口请求内容。 |
| 54 | + */ |
| 55 | + public static boolean IS_PRINT_REQUEST_STRING_LOG = true; |
| 56 | + |
51 | 57 | /**
|
52 | 58 | * 打印大数据量日志的标识。线上环境比较敏感,可以通过切换该变量来控制异常栈抛出、错误日志打印。保守起见,该值默认为false。
|
53 | 59 | * 与 {@link Log#DEBUG} 任何一个为 true 都会打印关键的接口请求及响应信息。
|
54 | 60 | */
|
55 |
| - public static boolean IS_PRINT_BIG_LOG = false; |
| 61 | + public static boolean IS_PRINT_BIG_LOG = true; |
| 62 | + |
| 63 | + /** |
| 64 | + * 可以通过切换该变量来控制是否打印关键的接口请求结束时间。保守起见,该值默认为false。 |
| 65 | + * 与 {@link Log#DEBUG} 任何一个为 true 都会打印关键的接口请求结束时间。 |
| 66 | + */ |
| 67 | + public static boolean IS_PRINT_REQUEST_ENDTIME_LOG = true; |
| 68 | + |
56 | 69 |
|
57 | 70 | /**
|
58 | 71 | * method = null
|
@@ -400,16 +413,18 @@ public JSONObject parseResponse(JSONObject request) {
|
400 | 413 |
|
401 | 414 | onClose();
|
402 | 415 |
|
403 |
| - System.err.println("\n\n\n\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n " |
404 |
| - + TAG + ".DEBUG: " + requestMethod + "/parseResponse request = \n" + requestString + "\n\n"); |
405 |
| - |
406 |
| - if (Log.DEBUG || IS_PRINT_BIG_LOG || error != null) { // 日志仅存服务器,所以不太敏感,而且这些日志虽然量大但非常重要,对排查 bug 很关键 |
407 |
| - System.err.println(TAG + ".DEBUG: " + requestMethod + "/parseResponse return response = \n" + JSON.toJSONString(requestObject) + "\n\n"); |
| 416 | + //CS304 Issue link: https://github.com/Tencent/APIJSON/issues/232 |
| 417 | + if (IS_PRINT_REQUEST_STRING_LOG||Log.DEBUG||error != null) { |
| 418 | + Log.sl("\n\n\n",'<',""); |
| 419 | + Log.fd(TAG , requestMethod + "/parseResponse request = \n" + requestString + "\n\n"); |
| 420 | + } |
| 421 | + if (IS_PRINT_BIG_LOG||Log.DEBUG||error != null) { // 日志仅存服务器,所以不太敏感,而且这些日志虽然量大但非常重要,对排查 bug 很关键 |
| 422 | + Log.fd(TAG,requestMethod + "/parseResponse return response = \n" + JSON.toJSONString(requestObject) + "\n\n"); |
| 423 | + } |
| 424 | + if (IS_PRINT_REQUEST_ENDTIME_LOG||Log.DEBUG||error != null) { |
| 425 | + Log.fd(TAG , requestMethod + "/parseResponse endTime = " + endTime + "; duration = " + duration); |
| 426 | + Log.sl("",'>',"\n\n\n"); |
408 | 427 | }
|
409 |
| - |
410 |
| - System.err.println(TAG + ".DEBUG: " + requestMethod + "/parseResponse endTime = " + endTime + "; duration = " + duration |
411 |
| - + "\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> \n\n\n"); |
412 |
| - |
413 | 428 | return res;
|
414 | 429 | }
|
415 | 430 |
|
|
0 commit comments