CollinAlpert / Lombok.NET

.NET adaptation for Java's Lombok using Source Generators.
MIT License
309 stars 16 forks source link

Log4j #34

Closed ghost closed 10 months ago

ghost commented 11 months ago

Hello! Lombok on Java provides annotation : https://projectlombok.org/api/lombok/extern/log4j/Log4j

Is it possible to implement in your code?

Thank you so much for your work!

CollinAlpert commented 11 months ago

I will look into this, should be possible.

CollinAlpert commented 11 months ago

I've looked at a few designs, but haven't found one I really like. Java's Lombok initializes the generated field by calling Logger.getLogger(), which is not something typically done in .NET where the logger is simply injected. In that case, you are better off using [AllArgsConstructor] or [RequiredArgsConstructor] to have the logger injected into your class.

If you have a different approach on how this could work, feel free to create a small reproduction of the code as well as the code which should be generated.

CollinAlpert commented 10 months ago

Closing for now due to lack of feedback. Feel free to open if necessary.