feat: 添加日志组件

This commit is contained in:
陈淳
2023-12-12 14:33:32 +08:00
parent aa49398c29
commit 8921b319c8
11 changed files with 2896 additions and 31 deletions

View File

@@ -222,7 +222,7 @@ namespace Yi.Framework.SqlSugarCore
{
if (Options.EnabledSqlLog)
{
Logger.CreateLogger<SqlSugarDbContext>().LogDebug(UtilMethods.GetSqlString(DbType.SqlServer, sql, pars));
Logger.CreateLogger<SqlSugarDbContext>().LogDebug("SQL执行:"+UtilMethods.GetSqlString(DbType.SqlServer, sql, pars));
}
}

View File

@@ -3,15 +3,24 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Volo.Abp.Auditing;
using Volo.Abp.DependencyInjection;
using Yi.Framework.Core.Helper;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.SqlSugarCore
{
public class SqlSugarLogAuditingStore : IAuditingStore, ISingletonDependency
{
private readonly ILogger<SqlSugarLogAuditingStore> _logger;
public SqlSugarLogAuditingStore(ILogger<SqlSugarLogAuditingStore> logger, ISqlSugarDbContext sqlSugarDbContext)
{
_logger= logger;
}
public Task SaveAsync(AuditLogInfo auditInfo)
{
_logger.LogDebug(JsonHelper.ObjToStr(auditInfo, "yyyy-MM-dd HH:mm:ss"));
//Console.WriteLine(auditInfo.ExecutionTime);
return Task.CompletedTask;
}