Пример #1
0
        public void Log(LogLevel logLevel, string message, IDictionary <string, object> properties = null, Exception exception = null)
        {
            var propertiesRedacted = new List <KeyValuePair <string, object> >();

            if (properties != null)
            {
                propertiesRedacted.AddRange
                (
                    properties.Select
                    (
                        property => new KeyValuePair <string, object>(property.Key, _redactor.Redact(property.Value))
                    ).ToList()
                );
            }

            if (_correlationService.CorrelationId != null)
            {
                propertiesRedacted.Add(new KeyValuePair <string, object>("CorrelationId", _correlationService.CorrelationId));
            }

            _logger.Log(logLevel, 1, ((object)(new LogState(propertiesRedacted))), exception, (_, exception) => Formatter(message, propertiesRedacted));
        }