Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
AntyaDev committed May 12, 2013
1 parent 94d8852 commit 697a4fc
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Expand Up @@ -67,5 +67,32 @@ internal class LoggingAspect : OnMethodBoundaryAspect
string logData = CreateLogData("Leaving", args);
Console.WriteLine(logData);
}

private string CreateLogData(string methodStage, MethodExecutionArgs args)
{
var str = new StringBuilder();
str.AppendLine();
str.AppendLine(string.Format(methodStage + " {0} ", args.Method));
foreach (var argument in args.Arguments)
{
var argType = argument.GetType();

str.Append(argType.Name + ": ");

if (argType == typeof(string) || argType.IsPrimitive)
{
str.Append(argument);
}
else
{
foreach (var property in argType.GetProperties())
{
str.AppendFormat("{0} = {1}; ",
property.Name, property.GetValue(argument, null));
}
}
}
return str.ToString();
}
}
```

0 comments on commit 697a4fc

Please sign in to comment.