Reputation: 6473
Are there any extensions / contribution projects which add several extensions to NLog, like for example logging automatically the current method and it's parameters? For example:
public void RegisterUserForPromotionalMaterialIfNotAlready(string email, string name, string telNo)
{
_log.Debug(_log.GetCurrentMethodAndParameters());
}
This would result in it say logging RegisterUserForPromotionalMaterialIfNotAlready([email protected], 'Test Name', 'Test Tel')
for example.
Upvotes: 0
Views: 380
Reputation: 6911
This is not possible without an interceptor implemented on the method itself. There is no way to programmatically sniff parameter values using just the .Net framework.
Here are some options for creating interceptors:
http://www.castleproject.org/projects/dynamicproxy/
http://www.postsharp.net/aspects
Upvotes: 1