/// <summary> /// 写日志 /// </summary> /// <param name="config">支付宝配置</param> /// <param name="builder">支付宝参数生成器</param> /// <param name="result">支付宝结果</param> protected void WriteLog(AlipayConfig config, AlipayParameterBuilder builder, AlipayResult result) { var log = GetLog(); if (log.IsTraceEnabled == false) { return; } log.Class(GetType().FullName) .Caption("支付宝支付") .Content($"支付宝方式 : {GetPayWay().Description()}") .Content($"支付网关 : {config.GetGatewayUrl()}") .Content("请求参数:") .Content(builder.GetDictionary()) .Content() .Content("返回结果:") .Content(result.GetDictionary()) .Content() .Content("原始请求:") .Content(builder.ToString()) .Content() .Content("原始响应:") .Content(result.Raw) .Trace(); }
/// <summary> /// 写日志 /// </summary> private void WriteLog(AlipayResult result) { var log = GetLog(); if (log.IsTraceEnabled == false) { return; } log.Class(GetType().FullName) .Caption("请求支付宝支付") .Content("支付方式 : {0}", GetPayWay().Description()) .Content("支付网关 : {0}", GetGatewayUrl()) .Content() .Content("请求参数:") .Content(_builder.GetDictionary()) .Content() .Content("返回结果:") .Content(result.GetDictionary()) .Content() .Content("原始请求:") .Content(_builder.ToString()) .Content() .Content("原始响应: ") .Content(result.Raw) .Trace(); }
/// <summary> /// 写日志 /// </summary> protected void WriteLog(AlipayConfig config, AlipayParameterBuilder builder, AlipayResult result) { Logger.Error(GetType().FullName + " 支付宝支付:" + $"支付方式 : {EnumUtil.GetEnumDescription(GetPayWay())}" + $"支付网关 : {config.GetGatewayUrl()}" + "请求参数:" + builder.GetDictionary() + "返回结果:" + result.GetDictionary() + "原始请求:" + builder.ToString() + "原始响应: " + result.Raw ); }
/// <summary> /// 写日志 /// </summary> protected void WriteLog(AliPayConfig config, AlipayParameterBuilder builder, AlipayResult result) { var logContent = LogContentBuilder.CreateLogContentBuilder() .SetEventId(Guid.NewGuid()).SetMoudle(GetType().FullName).SetTitle("支付宝支付") .AddContent($"支付宝支付 : {GetType()}") .AddContent($"支付网关 : {config?.GetGatewayUrl()}") .AddContent($"请求参数:{builder?.GetDictionary()?.ToXml()}") .AddContent($"返回结果:{result?.GetDictionary()}") .AddContent($"原始响应:{result?.Raw}") .Build(); Logger.LogInfo(logContent); }