I'm looking at adding logging all over my app (for insights), but I really don't want to add all that bloat to the code.
A typical method with logging will look like
public void SomeMethod() {
_logger.Log(this, "Start");
try{
// do stuff
} catch(Exception ex)
{
_logger.Log(this, ex);
}
_logger.Log(this, "End");
}
But my preference would be to decorate it with an interceptor.
[Log("")]
public void SomeMethod(){
// do stuff
}
I did take a peek at Fody and it might be able to do what I need, but I was hoping for something that didn't necessarily modify the binaries, but instead just intercept the method. Unfortunately I've never done AOP before, so I'm totally new to the paradigm. Also, I wonder if the approach I want without fody would require Reflection.Emit
???