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.
recyclarr/src/Recyclarr.Common/Serilog/ExceptionMessageEnricher.cs

19 lines
450 B

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));
}
}