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

            loggerSettings.Should().NotBeNull().And.Subject.Should().BeAssignableTo <ISerilogLoggerSettings>();
            loggerSettings.GetLogLevel(LoggingOutputFlags.Default).InitialLogLevel.Should().Be(LogLevel.Debug);
            loggerSettings.GetLogLevel(LoggingOutputFlags.Default).MinimumLogLevel.Should().Be(LogLevel.Debug);
        }
Example #2
0
        public void SerilogLoggerSettings_Constructor_IConfiguration()
        {
            var configuration  = SerilogLoggerSettings.DefaultLoggerSettingsConfiguration(LogLevel.Debug);
            var loggerSettings = new SerilogLoggerSettings(_fileSystem, configuration, LoggingOutputFlags.Default);

            loggerSettings.Should().NotBeNull().And.Subject.Should().BeAssignableTo <ISerilogLoggerSettings>();
            loggerSettings.Configuration.Should().Be(configuration);
            loggerSettings.GetLogLevel(LoggingOutputFlags.Default).InitialLogLevel.Should().Be(LogLevel.Debug);
            loggerSettings.GetLogLevel(LoggingOutputFlags.Default).MinimumLogLevel.Should().Be(LogLevel.Debug);
        }
Example #3
0
        public void SerilogLoggerSettings_RegisterSerilogLogLevel_Twice()
        {
            var loggerSettings = new SerilogLoggerSettings(_fileSystem, LogEventLevel.Debug, LoggingOutputFlags.Default);

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

            loggerSettings.RegisterLogLevel(LoggingOutputFlags.RollingFile, LogEventLevel.Debug);
            loggerSettings.GetLogLevel(LoggingOutputFlags.RollingFile).InitialLogLevel.Should().Be(LogLevel.Error);
            loggerSettings.GetLogLevel(LoggingOutputFlags.RollingFile).MinimumLogLevel.Should().Be(LogLevel.Debug);
        }
Example #4
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);
        }
Example #5
0
//        [InlineData(LogLevel.None)]
        public void SerilogLoggerSettings_Create_Default_LogLevels(LogLevel logLevel)
        {
            var loggerSettings = new SerilogLoggerSettings(_fileSystem, logLevel, LoggingOutputFlags.Default);

            loggerSettings.LoggingOutputFlags.Should().Be(LoggingOutputFlags.Default);

            // Serilog LogEventLevels
            loggerSettings.GetSerilogLogLevel(LoggingOutputFlags.Default).MinimumLogEventLevel.Should()
            .Be(SerilogLogLevel.MsftToSerilogLogLevel(logLevel));
            loggerSettings.GetSerilogLogLevel(LoggingOutputFlags.Default).InitialLogEventLevel.Should()
            .Be(SerilogLogLevel.MsftToSerilogLogLevel(logLevel));

            // Msft LogLevels
            loggerSettings.GetLogLevel(LoggingOutputFlags.Default).MinimumLogLevel.Should().Be(logLevel);
            loggerSettings.GetLogLevel(LoggingOutputFlags.Default).InitialLogLevel.Should().Be(logLevel);
        }
Example #6
0
        public void SerilogLoggerSettings_Constructor_LoggingOutputFlags(LoggingOutputFlags loggingOutputFlags)
        {
            var loggerSettings = new SerilogLoggerSettings(_fileSystem, LogEventLevel.Information, loggingOutputFlags);

            loggerSettings.Should().NotBeNull().And.Subject.Should().BeAssignableTo <ISerilogLoggerSettings>();
            var logLevel = loggerSettings.GetLogLevel(loggingOutputFlags);

            logLevel.Should().NotBeNull().And.Subject.Should().BeAssignableTo <IPureLogLevel>();

            logLevel.InitialLogLevel.Should().Be(LogLevel.Information);
            logLevel.MinimumLogLevel.Should().Be(LogLevel.Information);
        }