Exemple #1
0
 /// <summary>
 ///   Logs parameter values using json serialization.
 /// </summary>
 /// <param name="args">The parameters info.</param>
 /// <returns>Serialized values of parameters.</returns>
 private string LogJson(MethodInterceptionArgs args) =>
 args.Method.GetParameters()
 .WhereIf(LogPrimitiveParametersOnly, x => x.ParameterType.IsPrimitive || x.ParameterType.IsEnum)
 .Select((x, index) => ParameterNameValue.FormatWith(x.Name, JsonConvert.SerializeObject(args.Arguments[index])))
 .ToCommaSeparatedString();
Exemple #2
0
 /// <summary>
 ///   Adds the parameter to output result.
 /// </summary>
 /// <param name="builder">The output result builder.</param>
 /// <param name="name">The name of parameter.</param>
 /// <param name="value">The value of parameter.</param>
 private static void AddParameter(StringBuilder builder, string name, object value)
 => builder.AppendLine(ParameterNameValue.FormatWith(name, value ?? NullValue));