Add IHostApplicationBuilder support#780
Conversation
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #780 +/- ##
==========================================
- Coverage 81.58% 81.39% -0.19%
==========================================
Files 19 19
Lines 1765 1774 +9
Branches 315 315
==========================================
+ Hits 1440 1444 +4
- Misses 182 187 +5
Partials 143 143 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I think it looks great. And it seems you have solved the issue with global-state bleeding into the next test (by clearing global state) One could consider to introduce public static IHostApplicationBuilder UseNLog(this IHostApplicationBuilder builder, NLogProviderOptions options, Func<IServiceProvider, LogFactory> factoryBuilder) |
|
Do you expect any more changes, or is it ready to merge? |
|
Hi, I see the codes here public static IHostApplicationBuilder UseNLog(this IHostApplicationBuilder builder, NLogProviderOptions options, Func<IServiceProvider, LogFactory> factoryBuilder)
public static IHostBuilderr UseNLog(this IHostBuilder builder, NLogProviderOptions options, Func<IServiceProvider, LogFactory> factoryBuilder)And I have a question, what will happen after I add the Maybe in |
|
Hi, I was defeated by these providers, factories and builders. It might be a little difficult for me. |
|
Yes the extension-logic is very convoluted, with the support for dependency resolving combined with applying dynamic configuration.
I will merge this pull-request, and then see if I can figure out adding support for isolated LogFactory.
|
|
@mikezw I'm planning to get this released with NLog v5.5, before starting to update I expect to release NLog v5.5 within the next 1-2 weeks. I hope this works for you? P.S. Created #782 with support for isolated LogFactory |
|
Thank you very much. I will use it as soon as it is released |
|
NLog.Extensions.Logging v5.5 has been released to nuget: Thank you again for the contribution. |
Hi, I add a support of IHostApplicationBuilder, so we can use
IHostApplicationBuilder.UseNLog()after net8.0, but there is an issue when run bothUseNLog_LoadConfigurationFromSectionandIHostApplicationBuilder_UseNLog_LoadConfigurationFromSectionin tests. one will failed, Could anyone help take a look?