All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dahuatech.icc.oauth.utils.LogUtils Maven / Gradle / Ivy

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);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy