public void ConsoleLoggerOptions_TimeStampFormat_MultipleReloads() { var monitor = new TestOptionsMonitor(new ConsoleLoggerOptions()); var loggerProvider = new ConsoleLoggerProvider(monitor); var logger = (ConsoleLogger)loggerProvider.CreateLogger("Name"); Assert.Null(logger.Options.TimestampFormat); monitor.Set(new ConsoleLoggerOptions() { TimestampFormat = "yyyyMMdd" }); Assert.Equal("yyyyMMdd", logger.Options.TimestampFormat); monitor.Set(new ConsoleLoggerOptions() { TimestampFormat = "yyyyMMddHHmmss" }); Assert.Equal("yyyyMMddHHmmss", logger.Options.TimestampFormat); }
public void ConsoleLoggerOptions_LogAsErrorLevel_IsAppliedToLoggers() { // Arrange var monitor = new TestOptionsMonitor(new ConsoleLoggerOptions()); var loggerProvider = new ConsoleLoggerProvider(monitor); var logger = (ConsoleLogger)loggerProvider.CreateLogger("Name"); // Act & Assert Assert.Equal(LogLevel.None, logger.Options.LogToStandardErrorThreshold); monitor.Set(new ConsoleLoggerOptions() { LogToStandardErrorThreshold = LogLevel.Error }); Assert.Equal(LogLevel.Error, logger.Options.LogToStandardErrorThreshold); }
public void ConsoleLoggerOptions_DisableColors_IsReloaded() { // Arrange var monitor = new TestOptionsMonitor(new ConsoleLoggerOptions()); var loggerProvider = new ConsoleLoggerProvider(monitor); var logger = (ConsoleLogger)loggerProvider.CreateLogger("Name"); // Act & Assert Assert.Null(logger.Options.TimestampFormat); monitor.Set(new ConsoleLoggerOptions() { TimestampFormat = "yyyyMMddHHmmss" }); Assert.Equal("yyyyMMddHHmmss", logger.Options.TimestampFormat); }
public void ConsoleLoggerOptions_IncludeScopes_IsAppliedToLoggers() { // Arrange var monitor = new TestOptionsMonitor(new ConsoleLoggerOptions() { IncludeScopes = true }); var loggerProvider = new ConsoleLoggerProvider(monitor); var logger = (ConsoleLogger)loggerProvider.CreateLogger("Name"); // Act & Assert Assert.True(logger.Options.IncludeScopes); monitor.Set(new ConsoleLoggerOptions() { IncludeScopes = false }); Assert.False(logger.Options.IncludeScopes); }