Beispiel #1
0
        public void SerilogLoggerSettings_GetOrRegisterSerilogLogLevel_Twice()
        {
            var loggerSettings = new SerilogLoggerSettings(_fileSystem, LogEventLevel.Debug, LoggingOutputFlags.Default);

            loggerSettings.GetOrRegisterSerilogLogLevel(LoggingOutputFlags.RollingFile, LogEventLevel.Error);
            loggerSettings.GetLogLevel(LoggingOutputFlags.RollingFile).InitialLogLevel.Should().Be(LogLevel.Error);
            loggerSettings.GetLogLevel(LoggingOutputFlags.RollingFile).MinimumLogLevel.Should().Be(LogLevel.Error);

            loggerSettings.GetOrRegisterSerilogLogLevel(LoggingOutputFlags.RollingFile, LogEventLevel.Debug);
            loggerSettings.GetLogLevel(LoggingOutputFlags.RollingFile).InitialLogLevel.Should().Be(LogLevel.Error);

            // Does Not reset MinimumLogLevel to Debug as testLogLevel already exists
            loggerSettings.GetLogLevel(LoggingOutputFlags.RollingFile).MinimumLogLevel.Should().Be(LogLevel.Error);
        }
Beispiel #2
0
        public void SerilogLoggerSettings_GetOrRegisterSerilogLogLevel_Overrides()
        {
            var loggerSettings = new SerilogLoggerSettings(_fileSystem, LogEventLevel.Debug, LoggingOutputFlags.Default);

            loggerSettings.RegisterSerilogLogLevel(LoggingOutputFlags.RollingFile, LogLevel.Debug).MinimumLogLevel.Should().Be(LogLevel.Debug);
            loggerSettings.RegisterSerilogLogLevel(LoggingOutputFlags.TestCorrelator, LogEventLevel.Debug).MinimumLogLevel.Should().Be(LogLevel.Debug);
            loggerSettings.RegisterLogLevel(LoggingOutputFlags.AppInsights, LogEventLevel.Debug).MinimumLogLevel.Should().Be(LogLevel.Debug);
            loggerSettings.RegisterLogLevel(LoggingOutputFlags.Console, LogLevel.Debug).MinimumLogLevel.Should().Be(LogLevel.Debug);

            loggerSettings.GetOrRegisterSerilogLogLevel(LoggingOutputFlags.RollingFile, LogLevel.Debug).MinimumLogLevel.Should().Be(LogLevel.Debug);
            loggerSettings.GetOrRegisterLogLevel(LoggingOutputFlags.AppInsights, LogLevel.Debug).MinimumLogLevel.Should().Be(LogLevel.Debug);

            loggerSettings.GetSerilogLogLevel(LoggingOutputFlags.AppInsights).MinimumLogLevel.Should().Be(LogLevel.Debug);
        }