feat: 添加日志组件
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user