You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
962 B
C#

using System.Diagnostics;
using DS.Module.Core.Log;
using SqlSugar;
namespace DS.WMS.Core
{
public static class LogExtensions
{
public static void Log(this Exception ex, ISqlSugarClient db)
{
string className = string.Empty;
var stacktrace = new StackTrace();
if (stacktrace.FrameCount >= 0)
className = stacktrace.GetFrame(0).GetMethod().DeclaringType.Name;
var exLog = new SysLogException()
{
ClassName = className,
ExceptionName = ex.GetType().FullName,
ExceptionMsg = ex.Message,
ExceptionSource = ex.Source,
StackTrace = ex.StackTrace,
ParamsObj = ex.TargetSite.GetParameters().ToString(),
};
var scope = (SqlSugarScope)db;
scope.GetConnection(1288018625843826680).Insertable(exLog).ExecuteCommand();
}
}
}