public string BuildLogString(IInvocation invocation, InvocationPhase invocationPhase) { var sb = new StringBuilder(); sb.AppendFormat("{0}: {1}.{2}(", invocationPhase, invocation.TargetType.Name, invocation.Method.Name); foreach (var argument in invocation.Arguments) { var argumentDescription = argument == null ? "null" : ObjectToString(argument); sb.Append(argumentDescription).Append(","); } if (invocation.Arguments.Any()) sb.Length--; sb.Append(")"); if (invocation.ReturnValue != null) { sb.Append(", Returned: " + ObjectToString(invocation.ReturnValue)); } return sb.ToString(); }
public string BuildLogString(IInvocation invocation, InvocationPhase invocationPhase) { var sb = new StringBuilder(); sb.AppendFormat("{0}: {1}.{2}(", invocationPhase, invocation.TargetType.Name, invocation.Method.Name); foreach (var argument in invocation.Arguments) { var argumentDescription = argument == null ? "null" : ObjectToString(argument); sb.Append(argumentDescription).Append(","); } if (invocation.Arguments.Any()) { sb.Length--; } sb.Append(")"); if (invocation.ReturnValue != null) { sb.Append(", Returned: " + ObjectToString(invocation.ReturnValue)); } return(sb.ToString()); }