serilog-extensions-logging
serilog-extensions-logging copied to clipboard
Switch to Microsoft.Extensions.Logging.Abstractions
This PR adresses the following:
- Manage packages centrally instead of package version scattered all over the projects
- Switch to Microsoft.Extensions.Logging.Abstractions + Serilog as the only dependencies for the library
- Don't abuse the transitive dependency Microsoft.Extensions.Logging pulls in, such as Microsoft.Extensions.DependencyInjection to add DependencyInjection helpers, it should be more explicit then
- Switch test projects to a modern net5.0 tfm
- Update all dependencies to latest stable
- Adds sourcelink support to the NuGet packages
Thanks for the PR! This seems like it would cause significant pain downstream - many consumers of this package use loggingBuilder.AddSerilog() - any thoughts on how that should be handled?
Yeah, maybe it should be added back, but by adding a explicit dependency on Microsoft.Extensions.DependencyInjection.
Alternatively, that should live in a different assembly, but that is not nice either.
EDIT:
Actually, ILoggingBuilder is only present in Microsoft.Extensions.Logging and not the abstractions. Would it be a huge issue if the dependency injection stuff lived in its own assembly?
The same goes for the ProviderFilter attribute I removed.
EDIT 2:
I've just pushed a new commit where I added a separate library for the extension. Let me know if this is the route you want to go.
I don't know if it is related but we're about to completely dump Serilog over a MethodNotFound exception that seems to plague projects using the Microsoft Logging Abtractions. https://github.com/PowerShell/PowerShellEditorServices/issues/1477
I happened across this pull request and perhaps it would solve our issues.
I haven't 100% nailed it down, but it appears that when a calling process is running .Net 5, AddSerilog() is simply not available.
The odd part is when I add the full csproj to my solution and mark it as a project dependency it is magically resolvable.
PowerShellEditorServices isn't directly importing this extension, but it calls OmniSharp which appears to be using it.
Thoughts?
@dkattan thanks for the ping. I think the tracking issue on the Serilog side is https://github.com/serilog/serilog-sinks-file/issues/135 - will centralize discussion there.
@dkattan you could as an experiment try grabbing the artifacts on the AppVeyor build here: https://ci.appveyor.com/project/serilog/serilog-framework-logging/builds/39654298 and see how that works out for you.
@nblumhardt I've started implementing Serilog using the Microsoft.Extensions.Logging package as well. We've got .NET 6 and Framework 4.7.1 projects that we're straddling, but want to introduce the common interfaces from Microsoft.
I've had to manually pick Microsoft.Extensions.Logging version 2.0.0 (deprecated) instead of 2.2.0. I can open a new issue/PR if need be, but thought this issue related: can we at the very least version bump to 2.2.0 ?
@stphnlwlsh a separate PR that addresses the dependency version only would be welcome - this PR is unlikely to move forward at this point due to the potential for breaking changes downstream. Thanks for the note!
@stphnlwlsh a separate PR that addresses the dependency version only would be welcome - this PR is unlikely to move forward at this point due to the potential for breaking changes downstream. Thanks for the note!
@nblumhardt I suggest to close this abandoned PR since it mixes changes in CI with actual code changes. #214 upgrades the code base and CI without any actual code changes.
Of course switching to Microsoft.Extensions.Logging.Abstractions can be tracked by another issue if someone needs it.