Skip to content
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

Argument ordering on configuration lambda #22

Closed
ralphhendriks opened this issue May 23, 2020 · 2 comments
Closed

Argument ordering on configuration lambda #22

ralphhendriks opened this issue May 23, 2020 · 2 comments

Comments

@ralphhendriks
Copy link

In #20 (still in beta package) a new overload of UseSerilog() has been introduced

UseSerilog(
    this IHostBuilder builder,
    Action<HostBuilderContext, IServiceProvider, LoggerConfiguration> configureLogger,
    bool preserveStaticLogger = false,
    bool writeToProviders = false)

in addition to the already existing (publicly released)

UseSerilog(
    this IHostBuilder builder,
    Action<HostBuilderContext, LoggerConfiguration> configureLogger,
    bool preserveStaticLogger = false,
    bool writeToProviders = false)

Wouldn't it be more logical to change the ordering of the arguments on the configureLogging lambda of the newly added overload to HostBuilderContext, LoggerConfiguration, IServiceProvider? That makes refactoring of code just a little easier. I can contribute a PR, but only of course if this aligns with the views of the maintainers.

@nblumhardt
Copy link
Member

Thanks for the note. I spent some time thinking about this, too, and ended up concluding that LoggerConfiguration in the middle position felt arbitrary; the "logic" :-) behind the current argument ordering is (input, input, output), which might or might not make sense in this context. Open to changing it but could be a bikeshed, interested in more opinions 👍

@ralphhendriks
Copy link
Author

@nblumhardt thanks for the explanation of your rationale. Let's not turn this into a bikeshed indeed. Closing this issue.

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

No branches or pull requests

2 participants