public void Enrich(LogEvent logEvent, IShortcutPropertyFactory propertyFactory) { if (propertyFactory is null) { _processor.Process(logEvent); } else { _processor.Process(logEvent, propertyFactory); } }
/// <summary> /// Destructure the destructured object into LogEvent by given property factory. /// </summary> /// <param name="logEvent"></param> /// <param name="factory"></param> /// <exception cref="ArgumentNullException"></exception> public void Process(LogEvent logEvent, IShortcutPropertyFactory factory) { if (logEvent is null) { throw new ArgumentNullException(nameof(logEvent)); } if (factory is null) { throw new ArgumentNullException(nameof(factory)); } if (logEvent.Exception != null) { var destructuredObject = Destructure(logEvent.Exception); logEvent.AddExtraProperty(factory.CreateProperty(_destructuringOptions.Name, destructuredObject, true).AsExtra()); logEvent.ContextData.SetExceptionDetail(_destructuringOptions.Name, destructuredObject, logEvent.Exception, false); } }
static LogEventEnricherManager() { _enrichers = new List <ILogEventEnricher>(); _propertyFactory = MessageParameterProcessorCache.Get(); }