Skip to content

Serilog integration modifies LoggerConfiguration.MinimumLevel #70

@jonorossi

Description

@jonorossi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions