I am in the very alpha stage of a small website development project I am doing, and have decided to use NLog as my logging solution.
My solution is developed so far without logging. I am adding in the logging now.
An example:
private static Logger logger = LogManager.GetCurrentClassLogger();
public int SaveProject(ProjectDto project)
{
logger.Trace("SaveProject ({0}) : {1}", project.Id, _userId);
return _pb.SaveProject(project);
}
The 'GetCurrentClassLogger' method is great in that it now knows which class I am in.
But is there a way to report the Method name, instead of how I am doing it? In the example above, you can see I need to add "SaveProject" to the message. Is there a way to automatically get this? Or do I need to add this to every method logging call?