feat:uow & log

This commit is contained in:
xiaolipro 2026-01-15 15:30:57 +08:00
parent f0d96c0cb3
commit b6e3bb6678
2 changed files with 8 additions and 2 deletions

View File

@ -6,6 +6,9 @@
"Microsoft.AspNetCore": "Debug"
}
},
"Properties": {
"ServiceName": "interface-api"
},
"Enrich": [
"FromLogContext",
"WithMachineName",
@ -16,7 +19,8 @@
{
"Name": "Console",
"Args": {
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {SourceContext} - {Message:lj}{NewLine}{Exception}"
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {SourceContext} - {Message:lj}{NewLine}{Exception}",
"formatter": "Serilog.Formatting.Json.JsonFormatter, Serilog"
}
}
]

View File

@ -1,5 +1,6 @@
using System.Text;
using Fake.DependencyInjection;
using Fake.UnitOfWork;
using InterfaceForward.Application.Contracts.ForwardCore;
using InterfaceForward.Application.Services;
using InterfaceForward.Domain.Shared;
@ -24,7 +25,8 @@ public class BatchForwardEventHandler(
return options.Queue.StartsWith(BatchForwardEventSubscribe);
}
public async Task Handle(BasicDeliverEventArgs args)
[UnitOfWork]
public virtual async Task Handle(BasicDeliverEventArgs args)
{
var msg = Encoding.UTF8.GetString(args.Body.ToArray());