feat: 异常日志、消息日志支持独立日志库
This commit is contained in:
parent
5e0d8e770e
commit
cef9036ecc
@ -26,7 +26,9 @@ public class AppEventSubscriber : IEventSubscriber, ISingleton, IDisposable
|
||||
[EventSubscribe(CommonConst.AddExLog)]
|
||||
public async Task CreateExLog(EventHandlerExecutingContext context)
|
||||
{
|
||||
var db = _serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>();
|
||||
var db = SqlSugarSetup.ITenant.IsAnyConnection(SqlSugarConst.LogConfigId)
|
||||
? SqlSugarSetup.ITenant.GetConnectionScope(SqlSugarConst.LogConfigId)
|
||||
: SqlSugarSetup.ITenant.GetConnectionScope(SqlSugarConst.MainConfigId);
|
||||
await db.CopyNew().Insertable(context.GetPayload<SysLogEx>()).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
@ -38,7 +40,9 @@ public class AppEventSubscriber : IEventSubscriber, ISingleton, IDisposable
|
||||
[EventSubscribe(CommonConst.AddMsgLog)]
|
||||
public async Task CreateMsgLog(EventHandlerExecutingContext context)
|
||||
{
|
||||
var db = _serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>();
|
||||
var db = SqlSugarSetup.ITenant.IsAnyConnection(SqlSugarConst.LogConfigId)
|
||||
? SqlSugarSetup.ITenant.GetConnectionScope(SqlSugarConst.LogConfigId)
|
||||
: SqlSugarSetup.ITenant.GetConnectionScope(SqlSugarConst.MainConfigId);
|
||||
await db.CopyNew().Insertable(context.GetPayload<SysLogMsg>()).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user