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
460 B
19 lines
460 B
using Serilog.Core;
|
|
using Serilog.Events;
|
|
|
|
namespace Recyclarr.Common.Serilog;
|
|
|
|
public class ExceptionMessageEnricher : ILogEventEnricher
|
|
{
|
|
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
|
|
{
|
|
var msg = logEvent.Exception?.Message;
|
|
if (string.IsNullOrEmpty(msg))
|
|
{
|
|
return;
|
|
}
|
|
|
|
logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("ExceptionMessage", msg));
|
|
}
|
|
}
|