public void Enrich(LogEvent logEvent, IShortcutPropertyFactory propertyFactory)
 {
     if (propertyFactory is null)
     {
         _processor.Process(logEvent);
     }
     else
     {
         _processor.Process(logEvent, propertyFactory);
     }
 }
示例#2
0
        /// <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);
            }
        }
示例#3
0
 static LogEventEnricherManager()
 {
     _enrichers       = new List <ILogEventEnricher>();
     _propertyFactory = MessageParameterProcessorCache.Get();
 }