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

Allow custom logger providers #12

Open
bobted opened this issue May 31, 2018 · 1 comment
Open

Allow custom logger providers #12

bobted opened this issue May 31, 2018 · 1 comment

Comments

@bobted
Copy link

bobted commented May 31, 2018

Since both properties of BaseBuilder are protected internal, it is difficult to add custom ILoggerProvider instances to the default LoggerFactory in the connection.

I understand there is an extension method to provide a new instance of LoggerFactory, but in my case, I'd rather keep the LoggerFactory that the connection is using separate from the LoggerFactory that the rest of the app is using. However, I'd like to inject a LoggerProvider (i.e. Serilog) so the behavior of the logging can be managed via configuration.

I think the easiest solution would be an additional extension method in Xeeny.Extensions.Loggers.BaseBuilderExtenions.

        public static TBuilder WithCustomLoggerProvider<TBuilder>(this TBuilder builder, ILoggerProvider provider)
            where TBuilder : BaseBuilder
        {
            builder.LoggerFactory.AddProvider(provider);
            return builder;
        }
@bobted bobted changed the title Expose BaseBuilder.LoggerFactory with a public getter Allow custom logger providers May 31, 2018
@MhAllan
Copy link
Owner

MhAllan commented Jun 3, 2018

Noted, will add it asap.

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