Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to exclude things from being weaved #162

Open
kampilan opened this issue Feb 20, 2020 · 7 comments
Open

How to exclude things from being weaved #162

kampilan opened this issue Feb 20, 2020 · 7 comments

Comments

@kampilan
Copy link

First off, I have to congratulate you on a fantastic product. I just works great. I am using it to add an automatic logging feature to my logging framework.

I can't seam to figure out how to exclude things from automatic logging. Specifically I am trying to prevent the logging of getters and setters of automatic properties and default constructors. These things create a lot of clutter with no instrumentation value. I have searched through the test but I just can't seem to find an example of how to use ExcludePointcut. What patterns are supported? Where to place the attribute. On the Advice or the Class or Assembly etc?

Thanks
Jim

@kampilan
Copy link
Author

kampilan commented Feb 21, 2020

OK I dug through the closed issues and mostly answered my own question.

[ExcludePointcut( "get_", "set_")] on my advice does the trick. Is there a way to only apply this filter to automatic properties and not manually coded setters and getters?

Facing one last issue .. exclude default constructors, ones implied by the compiler. Any ideas?

Thanks

@picrap
Copy link
Member

picrap commented Feb 22, 2020

Hi, sorry for my late answer. Currently there is no way to exclude constructors, we could open an issue for these.

@kampilan
Copy link
Author

Thanks for the reply.
From my own selfish use case perspective:

  1. Excluding automatic property setters and getters
  2. Excluding default constructors
  3. Excluding based on an attribute I define. My advice is called AutoWatch and having a NoAutoWatch that excludes when placed on classes and methods is clearer. I currently use a NoAutoWatch attribute to perform the exclude in my Advice (post weaving). It would be better to have the NoAutoWatch exclude from weaving altogether.

Thanks for considering these.
Jim

@kampilan
Copy link
Author

kampilan commented Dec 4, 2020

Any chance of these items being considered?

Thanks
Jim

@picrap
Copy link
Member

picrap commented Dec 4, 2020

Yes, unfortunately I don’t work much for MrAdvice at the moment. This is probably quite simple to implement, so a pull request could be appreciated 😉

@kampilan
Copy link
Author

kampilan commented Dec 4, 2020

Thanks for the status update. You should probably mention that you are no longer actively working on this project on the front page. A project like this is quite complex and the value I derive from it compared to the effort it would take me to figure out how to make those enhancements on my own says I should find something else. Good luck!

@picrap
Copy link
Member

picrap commented Apr 27, 2021

I think we’ll probably go with advising from code at build-time, so anyone will be able to perform its own customizations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants