-
Notifications
You must be signed in to change notification settings - Fork 213
Expose SerilogLoggerFactory
#19
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
Conversation
I needed to retrieve some configuration prior to registering the logger. `UseSerilog` is invoked before the `Startup` class. I sought to register the Factory manually but found out that is internal. I think that `SerilogLoggerFactory` is the main take away from this library and therefore exposing it would make it more flexible for those who don't want to use the extension methods.
|
Thanks for the PR, @jonathansant. Does the alternative overload of Best regards, |
|
Since all my startup logic is in the |
|
Thanks for the reply. I think providing the factory type is fine 👍 |
nblumhardt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just minor nitpicks. Thanks!
| /// Implements Microsoft's ILoggerFactory so that we can inject Serilog Logger. | ||
| /// </summary> | ||
| /// <seealso cref="Microsoft.Extensions.Logging.ILoggerFactory" /> | ||
| public class SerilogLoggerFactory : ILoggerFactory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation is funny here and below - may need to use spaces, rather than tabs?
| { | ||
| class SerilogLoggerFactory : ILoggerFactory | ||
| /// <summary> | ||
| /// Implements Microsoft's ILoggerFactory so that we can inject Serilog Logger. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of Microsoft's ILoggerFactory we could use <see cref="ILoggerFactory"/>
| /// Initializes a new instance of the <see cref="SerilogLoggerFactory"/> class. | ||
| /// </summary> | ||
| /// <param name="logger">The logger.</param> | ||
| /// <param name="dispose">if set to <c>true</c> [dispose].</param> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use the same documentation here as in https://github.com/serilog/serilog-aspnetcore/blob/dev/src/Serilog.AspNetCore/SerilogWebHostBuilderExtensions.cs#L33
|
Thank you 👍 |
I needed to retrieve some configuration prior to registering the logger.
UseSerilogis invoked before theStartupclass. I sought to register the Factory manually but found out that is internal. I think thatSerilogLoggerFactoryis the main take away from this library and therefore exposing it would make it more flexible for those who don't want to use the extension methods.