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

Serilog integration modifies LoggerConfiguration.MinimumLevel #70

Closed
jonorossi opened this issue Nov 5, 2014 · 1 comment
Closed

Serilog integration modifies LoggerConfiguration.MinimumLevel #70

jonorossi opened this issue Nov 5, 2014 · 1 comment

Comments

@jonorossi
Copy link
Member

The SerilogFactory.Create(string name, Castle.Core.Logging.LoggerLevel level) overload modifies the MinimumLevel of the passed in LoggerConfiguration and overwrites it with the equivalent logging level to the Castle LoggerLevel enum. Each call of the Create method will modify the single LoggerConfiguration object with the level being passed in.

There is no need for the Serilog integration to support this overload, it is only there for loggers that don't support levels (e.g. ConsoleLogger, TraceLogger) which use LevelFilteredLogger. It just confuses things to have two logging frameworks filtering by log levels. Both log4net and NLog integrations throw a NotSupportedException for this overload.

var config = new LoggerConfiguration()
    .WriteTo....

var factory = new SerilogFactory(config);
var logger = factory.Create("MyLogger", LoggerLevel.Debug); <-- config has been modified by the factory
@jonorossi
Copy link
Member Author

I've removed the implementation of this overload, and changed it to throw an exception like the log4net and NLog ones so users don't get bitten by this.

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

1 participant