com.dahuatech.icc.oauth.utils.LogUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-sdk-oauth Show documentation
Show all versions of java-sdk-oauth Show documentation
Dahua ICC Open API SDK for Java
The newest version!
package com.dahuatech.icc.oauth.utils;
import com.dahuatech.hutool.json.JSONUtil;
import com.dahuatech.hutool.log.Log;
import com.dahuatech.icc.oauth.http.IccHttpHttpRequest;
public class LogUtils {
public static boolean isPrint = false;
public static void printIn(Log logger, IccHttpHttpRequest request,boolean isInfo){
if(isInfo){
logger.info("uuid=[{}],url=[{}] ,入参:body=[{}],form=[{}]", request.getRequestUniqueCode(),request.getUrl(), request.getBody(), JSONUtil.toJsonStr(request.getForm()));
}else{
logger.debug("uuid=[{}],url=[{}] ,入参:body=[{}],form=[{}]", request.getRequestUniqueCode(),request.getUrl(), request.getBody(), JSONUtil.toJsonStr(request.getForm()));
}
}
public static void printOut(Log logger, String uuid, String result,boolean isInfo){
if(isInfo){
logger.info("uuid=[{}] ,返回:response=[{}]", uuid, result);
}else{
logger.debug("uuid=[{}] ,返回:response=[{}]", uuid, result);
}
}
public static void printOutError(Log logger, String uuid, String result){
logger.error("uuid=[{}] ,返回:response=[{}]", uuid, result);
}
public static void printIn(Log logger, IccHttpHttpRequest request){
printIn(logger,request,isPrint);
}
public static void printOut(Log logger, String uuid, String result){
printOut(logger,uuid,result,isPrint);
}
}