You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
450 B
19 lines
450 B
2 years ago
|
using Serilog.Core;
|
||
|
using Serilog.Events;
|
||
|
|
||
|
namespace Recyclarr.Common.Serilog;
|
||
|
|
||
|
public class ExceptionMessageEnricher : ILogEventEnricher
|
||
|
{
|
||
|
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
|
||
|
{
|
||
|
if (logEvent.Exception is null)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty(
|
||
|
"ExceptionMessage", logEvent.Exception.Message));
|
||
|
}
|
||
|
}
|