Skip to content

Integrate with LoggerProviderCollection #87

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

Merged
merged 4 commits into from
Jun 3, 2019
Merged

Integrate with LoggerProviderCollection #87

merged 4 commits into from
Jun 3, 2019

Conversation

nblumhardt
Copy link
Member

@nblumhardt nblumhardt commented May 22, 2019

This will integrate UseSerilog() with the ILoggerProvider support in upstream Serilog.Extensions.Logging.

For the more self-contained (post-IoC-initialization) variant, it'll be as simple as UseSerilog(writeToProviders: true).

When logging is configured first, at program startup, a LoggerProviderCollection will need to be constructed and passed to WriteTo.Providers() as well as UseSerilog().

For some context, this will enable usage like: opentracing-contrib/csharp-netcore#42

Resolves #53

@andrewlock I'm hoping this will translate cleanly across to Serilog.Extensions.Hosting, and once we're happy with it here, I'll assemble a second PR :-)

  • Working
  • Tests Turns out there isn't really any (sanely) testable implementation in this package, it's all now in Serilog.Extensions.Logging
  • Should the second UseSerilog() overload default to writing to providers? No :-)
  • README updates
  • Make sure providers added after logger initialization are still added to the LPC

@nblumhardt nblumhardt changed the title [WIP] Integrate with LoggerProviderCollection Integrate with LoggerProviderCollection May 28, 2019
@nblumhardt
Copy link
Member Author

I know it's currently tricky for everyone to keep abreast of these changes; I think as in Serilog.Extensions.Logging our best bet is to send them through to dev and feel our way forwards from there.

Just one thing to call out - this changes the signature of UseSerilog() in a source, but not binary-compatible way. I think this is acceptable for this package, on a major version update, as it's unlikely to be involved in any nasty diamond dependency scenarios.

I'll hit the button in a day or so unless I hear from anyone.

@nblumhardt nblumhardt merged commit a04cbb2 into dev Jun 3, 2019
nblumhardt added a commit to nblumhardt/serilog-extensions-hosting that referenced this pull request Jun 23, 2019
@nblumhardt nblumhardt mentioned this pull request Aug 27, 2019
@nblumhardt nblumhardt deleted the add-providers branch September 2, 2019 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move SerilogLoggerFactory to Serilog.Extensions.Logging
1 participant