Currently PostSharp itself cannot modify your code to remove the calls to your existing Log.Start()
and Log.Stop()
methods.
I may suggest an easy solution to apply refactoring and modify your existing logging methods, so that they do not perform logging anymore (maybe based on a condition). And inside your aspect call other new logging methods, that will perform actual logging.
public override void OnEntry(MethodExecutionArgs args)
{
Log.NewStart();
}
public override void OnExit(MethodExecutionArgs args)
{
Log.NewStop();
}
If you want a more advanced solution, then in your old logging methods' condition you could check whether the LogAspect
has been applied to the current method and skip logging only in that case. But this will be quite difficult to implement and probably won't pay off with your requirement of minimal effort to add AOP.