public CreatePropertyValue ( object value, Destructuring destructuring ) : |
||
value | object | |
destructuring | Destructuring | |
return |
IEnumerable <LogEventProperty> ConstructNamedProperties(MessageTemplate template, object[] messageTemplateParameters) { var namedProperties = template.NamedProperties; if (namedProperties == null) { return(Enumerable.Empty <LogEventProperty>()); } var matchedRun = namedProperties.Length; if (namedProperties.Length != messageTemplateParameters.Length) { matchedRun = Math.Min(namedProperties.Length, messageTemplateParameters.Length); SelfLog.WriteLine("Named property count does not match parameter count: {0}", template); } var result = new LogEventProperty[messageTemplateParameters.Length]; for (var i = 0; i < matchedRun; ++i) { var property = template.NamedProperties[i]; var value = messageTemplateParameters[i]; result[i] = ConstructProperty(property, value); } for (var i = matchedRun; i < messageTemplateParameters.Length; ++i) { var value = _valueConverter.CreatePropertyValue(messageTemplateParameters[i]); result[i] = new LogEventProperty("__" + i, value); } return(result); }
public LogEventPropertyValue CreatePropertyValue(object value, bool destructureObjects = false) { if (_currentDepth == MaximumDestructuringDepth) { SelfLog.WriteLine("Maximium destructuring depth reached."); return(new ScalarValue(null)); } return(_propertyValueConverter.CreatePropertyValue(value, destructureObjects, _currentDepth + 1)); }
public LogEventPropertyValue CreatePropertyValue(object value, Destructuring destructuring) { return(DefaultIfMaximumDepth() ?? _propertyValueConverter.CreatePropertyValue(value, destructuring, _currentDepth + 1)); }
LogEventProperty ConstructProperty(PropertyToken propertyToken, object value) { return(new LogEventProperty( propertyToken.PropertyName, _valueConverter.CreatePropertyValue(value, propertyToken.Destructuring))); }