-
Notifications
You must be signed in to change notification settings - Fork 8
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
Replace IConfigCatLogger with Microsoft.Extensions.Logging.ILogger #80
Comments
Hi @damianh, Although MS.Extensions.Logging is the standard logging facade for ASP.NET Core, it is not necessarily used in other types of applications. So, since we aim to provide as broad support for other application types / .NET platforms as possible, I don't think we want to force all of our users to adopt (or adapt to) MS.Extensions.Logging. E.g. for a user who has a WPF app which was built on, let's say, Serilog, MS.Extensions.Logging would be an extra, unnecessary dependency, for which they would need an adapter anyway. So, in overall, it seems to be a better choice to not favor a single logging framework over the others but provide a uniform solution to all SDK users. Of course, we are aware that MS.Extensions.Logging is a very common choice, so we already created an adapter for this one (which supports even structured logging). You can find it here. I believe it is a tolerable DX to copy-paste a file into your project but let us know if you think otherwise. |
Hi @adams85, Thanks for response! I'm quite familiar with the topic of logger interfaces, frameworks, adapters, and in particular, dependencies - back in the day I shipped LibLog to solve this for library developers.
I'm not saying favouring any single logging framework but instead use the abstraction the is now the defacto abstraction in .NET, for which every logging framework already has an adapter. Since it's shipped by MS (unlike Common.Logging of yore) it's a fairly safe dependency to take, I will argue. The issue with having your own unique interface, and not ship a suite of adapters, is that users will write their own and/or copy code. I'll argue that is unnecessary today when the ecosystem is coalescing around MSEL (for better or worse, only MS is enabled to ship ecosystem level interfaces). If I can't convince you after this message, feel free to close the issue. I'll copy the adapter and move on. :) |
Your arguments are perfectly valid, MSEL is indeed the de facto standard now. However, in our case there are some other factors that also need to be taken into account when we are considering switching to MSEL.
So, no matter how i look at it, the time is not right for this change at the moment. However, there are no hard blockers either, so nothing stops us from doing this in the future. We have plans to drop the support for .NET 4.5 sooner or later. When that time comes, we should definitely reconsider your idea, so I will leave open the issue. |
.NET 4.5 is a very valid point and at the time of dropping that would seem a good time to consider this. I certainly wasn't expecting a such breaking a change overnight; just wanted get the request in so it's considered at the right time. On a related note - yeah more alignment with DI and options patterns used nowadays would also be appreciated. Cheers. |
This issue is marked stale because it has no activity in the last 3 weeks. The issue will be closed in one week. Please remove the stale flag to keep it open. |
Hi @adams85, I understand the backward compatibility need and how to keep that stability for ConfigCat customers. Knowing and being aligned with Microsoft's release and support cycles, it is fair to consider moving forward and keeping the SDK current with the new standards. Would it be possible to decouple the current logging structure from the SDK and provide sub-packages? This does the inverse of what every new customer needs to do by creating a logging adapter, but it'll serve legacy code instead, whereas, for new implementations, virtually nothing needs to be done. |
Hey @luizbon, You're right that the current solution might not be optimal for customers who are already on the .NET Core/NET 5+ train. I consulted with the team and we all agree that the situation could be improved. However, we still think that it would be better to keep the platform-agnostic logging facade in the core SDK package, for the reasons mentioned above. We think the best solution would be something like what you suggest but in reverse: let's leave the How do you like this idea? Would this be an acceptable solution for you? |
Thanks for evaluating the idea @adams85. |
Sounds like a reasonable trade off. |
Thank you both for sharing your opinions and suggestions. We added this item to our backlog. I can't give you an ETA yet but we are going to implement it eventually. |
This issue is marked stale because it has no activity in the last 3 weeks. The issue will be closed in one week. Please remove the stale flag to keep it open. |
Is your feature request related to a problem? Please describe.
Minor inconvenience of having to author an adapter between IConfigCatLogger and Microsoft.Extensions.Logging.ILogger
Describe the solution you'd like
Be able to inject an Microsoft.Extensions.Logging.ILogger into ConfigCatClient factory method.
Describe alternatives you've considered
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered: