Skip to content

Commit 1b6275a

Browse files
committed
🎨 优化部分日志输出,调整输出级别
1 parent 5f34a88 commit 1b6275a

File tree

5 files changed

+25
-21
lines changed

5 files changed

+25
-21
lines changed

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/BaseWxCpServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,12 +333,12 @@ protected <T, E> T executeInternal(RequestExecutor<T, E> executor, String uri, E
333333
}
334334

335335
if (error.getErrorCode() != 0) {
336-
log.error("\n【请求地址】: {}\n【请求参数】:{}\n【错误信息】:{}", uriWithAccessToken, dataForLog, error);
336+
log.warn("\n【请求地址】: {}\n【请求参数】:{}\n【错误信息】:{}", uriWithAccessToken, dataForLog, error);
337337
throw new WxErrorException(error, e);
338338
}
339339
return null;
340340
} catch (IOException e) {
341-
log.error("\n【请求地址】: {}\n【请求参数】:{}\n【异常信息】:{}", uriWithAccessToken, dataForLog, e.getMessage());
341+
log.warn("\n【请求地址】: {}\n【请求参数】:{}\n【异常信息】:{}", uriWithAccessToken, dataForLog, e.getMessage());
342342
throw new WxRuntimeException(e);
343343
}
344344
}

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/BaseWxMaServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,12 @@ private <T, E> T executeInternal(RequestExecutor<T, E> executor, String uri, E d
296296
}
297297

298298
if (error.getErrorCode() != 0) {
299-
log.error("\n【请求地址】: {}\n【请求参数】:{}\n【错误信息】:{}", uriWithAccessToken, dataForLog, error);
299+
log.warn("\n【请求地址】: {}\n【请求参数】:{}\n【错误信息】:{}", uriWithAccessToken, dataForLog, error);
300300
throw new WxErrorException(error, e);
301301
}
302302
return null;
303303
} catch (IOException e) {
304-
log.error("\n【请求地址】: {}\n【请求参数】:{}\n【异常信息】:{}", uriWithAccessToken, dataForLog, e.getMessage());
304+
log.warn("\n【请求地址】: {}\n【请求参数】:{}\n【异常信息】:{}", uriWithAccessToken, dataForLog, e.getMessage());
305305
throw new WxRuntimeException(e);
306306
}
307307
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,12 +435,12 @@ protected <T, E> T executeInternal(RequestExecutor<T, E> executor, String uri, E
435435
}
436436

437437
if (error.getErrorCode() != 0) {
438-
log.error("\n【请求地址】: {}\n【请求参数】:{}\n【错误信息】:{}", uriWithAccessToken, dataForLog, error);
438+
log.warn("\n【请求地址】: {}\n【请求参数】:{}\n【错误信息】:{}", uriWithAccessToken, dataForLog, error);
439439
throw new WxErrorException(error, e);
440440
}
441441
return null;
442442
} catch (IOException e) {
443-
log.error("\n【请求地址】: {}\n【请求参数】:{}\n【异常信息】:{}", uriWithAccessToken, dataForLog, e.getMessage());
443+
log.warn("\n【请求地址】: {}\n【请求参数】:{}\n【异常信息】:{}", uriWithAccessToken, dataForLog, e.getMessage());
444444
throw new WxErrorException(e);
445445
}
446446
}

weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenServiceAbstractImpl.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package me.chanjar.weixin.open.api.impl;
22

3+
import lombok.extern.slf4j.Slf4j;
34
import me.chanjar.weixin.common.enums.WxType;
45
import me.chanjar.weixin.common.error.WxError;
56
import me.chanjar.weixin.common.error.WxErrorException;
@@ -17,8 +18,8 @@
1718
/**
1819
* @author <a href="https://github.com/007gzs">007</a>
1920
*/
21+
@Slf4j
2022
public abstract class WxOpenServiceAbstractImpl<H, P> implements WxOpenService, RequestHttp<H, P> {
21-
private final Logger log = LoggerFactory.getLogger(this.getClass());
2223
private WxOpenComponentService wxOpenComponentService = new WxOpenComponentServiceImpl(this);
2324
private WxOpenConfigStorage wxOpenConfigStorage;
2425

@@ -46,17 +47,17 @@ public void setWxOpenConfigStorage(WxOpenConfigStorage wxOpenConfigStorage) {
4647
protected <T, E> T execute(RequestExecutor<T, E> executor, String uri, E data) throws WxErrorException {
4748
try {
4849
T result = executor.execute(uri, data, WxType.Open);
49-
this.log.debug("\n【请求地址】: {}\n【请求参数】:{}\n【响应数据】:{}", uri, data, result);
50+
log.debug("\n【请求地址】: {}\n【请求参数】:{}\n【响应数据】:{}", uri, data, result);
5051
return result;
5152
} catch (WxErrorException e) {
5253
WxError error = e.getError();
5354
if (error.getErrorCode() != 0) {
54-
this.log.error("\n【请求地址】: {}\n【请求参数】:{}\n【错误信息】:{}", uri, data, error);
55+
log.warn("\n【请求地址】: {}\n【请求参数】:{}\n【错误信息】:{}", uri, data, error);
5556
throw new WxErrorException(error, e);
5657
}
5758
return null;
5859
} catch (IOException e) {
59-
this.log.error("\n【请求地址】: {}\n【请求参数】:{}\n【异常信息】:{}", uri, data, e.getMessage());
60+
log.warn("\n【请求地址】: {}\n【请求参数】:{}\n【异常信息】:{}", uri, data, e.getMessage());
6061
throw new WxRuntimeException(e);
6162
}
6263
}

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/CustomDeclarationService.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,18 @@
1313
*/
1414
public interface CustomDeclarationService {
1515

16-
static String DECLARATION_BASE_URL = "https://apihk.mch.weixin.qq.com/global/v3/customs";
16+
/**
17+
* The constant DECLARATION_BASE_URL.
18+
*/
19+
String DECLARATION_BASE_URL = "https://apihk.mch.weixin.qq.com/global/v3/customs";
1720

1821
/**
1922
* <pre>
2023
* 报关API
21-
* 文档地址: https://pay.weixin.qq.com/wiki/doc/api/wxpay/ch/declarecustom_ch/chapter3_1.shtml
24+
* 文档地址: <a href="https://pay.weixin.qq.com/wiki/doc/api/wxpay/ch/declarecustom_ch/chapter3_1.shtml">...</a>
2225
* </pre>
2326
*
24-
* @param request
27+
* @param request the request
2528
* @return 返回数据 declaration result
2629
* @throws WxPayException the wx pay exception
2730
*/
@@ -30,10 +33,10 @@ public interface CustomDeclarationService {
3033
/**
3134
* <pre>
3235
* 报关查询API
33-
* 文档地址: https://pay.weixin.qq.com/wiki/doc/api/wxpay/ch/declarecustom_ch/chapter3_3.shtml
36+
* 文档地址: <a href="https://pay.weixin.qq.com/wiki/doc/api/wxpay/ch/declarecustom_ch/chapter3_3.shtml">...</a>
3437
* </pre>
3538
*
36-
* @param request
39+
* @param request the request
3740
* @return 返回数据 declaration query result
3841
* @throws WxPayException the wx pay exception
3942
*/
@@ -42,10 +45,10 @@ public interface CustomDeclarationService {
4245
/**
4346
* <pre>
4447
* 身份信息校验API
45-
* 文档地址: https://pay.weixin.qq.com/wiki/doc/api/wxpay/ch/declarecustom_ch/chapter3_2.shtml
48+
* 文档地址: <a href="https://pay.weixin.qq.com/wiki/doc/api/wxpay/ch/declarecustom_ch/chapter3_2.shtml">...</a>
4649
* </pre>
4750
*
48-
* @param request
51+
* @param request the request
4952
* @return 返回数据 verify certification result
5053
* @throws WxPayException the wx pay exception
5154
*/
@@ -54,10 +57,10 @@ public interface CustomDeclarationService {
5457
/**
5558
* <pre>
5659
* 报关信息修改API
57-
* 文档地址: https://pay.weixin.qq.com/wiki/doc/api/wxpay/ch/declarecustom_ch/chapter3_5.shtml
60+
* 文档地址: <a href="https://pay.weixin.qq.com/wiki/doc/api/wxpay/ch/declarecustom_ch/chapter3_5.shtml">...</a>
5861
* </pre>
5962
*
60-
* @param request
63+
* @param request the request
6164
* @return 返回数据 declaration result
6265
* @throws WxPayException the wx pay exception
6366
*/
@@ -66,10 +69,10 @@ public interface CustomDeclarationService {
6669
/**
6770
* <pre>
6871
* 报关重推API
69-
* 文档地址: https://pay.weixin.qq.com/wiki/doc/api/wxpay/ch/declarecustom_ch/chapter3_4.shtml
72+
* 文档地址: <a href="https://pay.weixin.qq.com/wiki/doc/api/wxpay/ch/declarecustom_ch/chapter3_4.shtml">...</a>
7073
* </pre>
7174
*
72-
* @param request
75+
* @param request the request
7376
* @return 返回数据 redeclaration result
7477
* @throws WxPayException the wx pay exception
7578
*/

0 commit comments

Comments
 (0)