forked from abpframework/abp
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
abp_io/src/Volo.AbpWebSite.Web/CorrelationIdLogEventEnricher.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Serilog.Core; | ||
using Serilog.Events; | ||
using Volo.Abp.DependencyInjection; | ||
using Volo.Abp.Tracing; | ||
|
||
namespace Volo.AbpWebSite | ||
{ | ||
//This is for trial for now | ||
public class CorrelationIdLogEventEnricher : ILogEventEnricher, ITransientDependency | ||
{ | ||
private readonly ICorrelationIdProvider _correlationIdProvider; | ||
|
||
public CorrelationIdLogEventEnricher(ICorrelationIdProvider correlationIdProvider) | ||
{ | ||
_correlationIdProvider = correlationIdProvider; | ||
} | ||
|
||
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) | ||
{ | ||
logEvent.AddOrUpdateProperty( | ||
new LogEventProperty( | ||
"CorrelationId", | ||
new ScalarValue("CorrId:" + _correlationIdProvider.Get()) | ||
) | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters