Example #1
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);
        }
Example #2
0
        public void SerilogLoggerSettings_GetOrRegisterLogLevel_Twice()
        {
            var          loggerSettings = new SerilogLoggerSettings(_fileSystem, LogEventLevel.Debug, LoggingOutputFlags.Default);
            const string testLogLevel   = "TestLogLevel";

            loggerSettings.RegisterLogLevel(testLogLevel, LogLevel.Error);
            loggerSettings.GetLogLevel(testLogLevel).InitialLogLevel.Should().Be(LogLevel.Error);
            loggerSettings.GetLogLevel(testLogLevel).MinimumLogLevel.Should().Be(LogLevel.Error);

            loggerSettings.GetOrRegisterLogLevel(testLogLevel, LogLevel.Debug);
            loggerSettings.GetLogLevel(testLogLevel).InitialLogLevel.Should().Be(LogLevel.Error);

            // Does Not reset MinimumLogLevel to Debug as testLogLevel already exists
            loggerSettings.GetLogLevel(testLogLevel).MinimumLogLevel.Should().Be(LogLevel.Error);
        }