1 write to Level
Microsoft.Extensions.Diagnostics.Testing (1)
Logging\FakeLogRecord.cs (1)
32Level = level;
132 references to Level
Aspire.Hosting.Testing.Tests (6)
ResourceLoggerForwarderServiceTests.cs (6)
119log => { Assert.Equal(LogLevel.Information, log.Level); Assert.Equal("1: 2000-12-29T20:59:59.0000000Z Test trace message", log.Message); Assert.Equal("TestApp.AppHost.Resources.myresource", log.Category); }, 120log => { Assert.Equal(LogLevel.Information, log.Level); Assert.Equal("2: 2000-12-29T20:59:59.0000000Z Test debug message", log.Message); Assert.Equal("TestApp.AppHost.Resources.myresource", log.Category); }, 121log => { Assert.Equal(LogLevel.Information, log.Level); Assert.Equal("3: 2000-12-29T20:59:59.0000000Z Test information message", log.Message); Assert.Equal("TestApp.AppHost.Resources.myresource", log.Category); }, 122log => { Assert.Equal(LogLevel.Information, log.Level); Assert.Equal("4: 2000-12-29T20:59:59.0000000Z Test warning message", log.Message); Assert.Equal("TestApp.AppHost.Resources.myresource", log.Category); }, 123log => { Assert.Equal(LogLevel.Error, log.Level); Assert.Equal("5: 2000-12-29T20:59:59.0000000Z Test error message", log.Message); Assert.Equal("TestApp.AppHost.Resources.myresource", log.Category); }, 124log => { Assert.Equal(LogLevel.Error, log.Level); Assert.Equal("6: 2000-12-29T20:59:59.0000000Z Test critical message", log.Message); Assert.Equal("TestApp.AppHost.Resources.myresource", log.Category); });
Aspire.Hosting.Tests (17)
ResourceNotificationTests.cs (17)
307Assert.Single(logs.Where(l => l.Level == LogLevel.Debug)); 308Assert.Contains(logs, l => l.Level == LogLevel.Debug && l.Message.Contains("Resource resource1/resource1 changed state: SomeState")); 317Assert.DoesNotContain(logs, l => l.Level == LogLevel.Debug); 318Assert.DoesNotContain(logs, l => l.Level == LogLevel.Debug && l.Message.Contains("Resource resource1/resource1 changed state: SomeState")); 327Assert.Single(logs.Where(l => l.Level == LogLevel.Debug)); 328Assert.Contains(logs, l => l.Level == LogLevel.Debug && l.Message.Contains("Resource resource1/resource1 changed state: SomeState -> NewState")); 337Assert.DoesNotContain(logs, l => l.Level == LogLevel.Debug); 338Assert.DoesNotContain(logs, l => l.Level == LogLevel.Debug && l.Message.Contains("Resource resource1/resource1 changed state:")); 347Assert.DoesNotContain(logs, l => l.Level == LogLevel.Debug); 348Assert.DoesNotContain(logs, l => l.Level == LogLevel.Debug && l.Message.Contains("Resource resource1/resource1 changed state:")); 357Assert.DoesNotContain(logs, l => l.Level == LogLevel.Debug); 358Assert.DoesNotContain(logs, l => l.Level == LogLevel.Debug && l.Message.Contains("Resource resource1/resource1 changed state:")); 377Assert.Single(logs.Where(l => l.Level == LogLevel.Debug)); 378Assert.Equal(3, logs.Where(l => l.Level == LogLevel.Trace).Count()); 379Assert.Contains(logs, l => l.Level == LogLevel.Trace && l.Message.Contains("Resource resource1/resource1 update published:") && l.Message.Contains($"CreationTimeStamp = {createdDate:s}")); 380Assert.Contains(logs, l => l.Level == LogLevel.Trace && l.Message.Contains("Resource resource1/resource1 update published:") && l.Message.Contains("State = { Text = SomeState")); 381Assert.Contains(logs, l => l.Level == LogLevel.Trace && l.Message.Contains("Resource resource1/resource1 update published:") && l.Message.Contains("ExitCode = 0"));
Aspire.Playground.Tests (2)
Infrastructure\DistributedApplicationExtensions.cs (2)
139AssertDoesNotContain(appHostlogs, log => log.Level >= LogLevel.Error && log.Category != "Microsoft.Extensions.Diagnostics.HealthChecks.DefaultHealthCheckService"); 140AssertDoesNotContain(resourceLogs, log => log.Category is { Length: > 0 } category && assertableResourceLogNames.Contains(category) && log.Level >= LogLevel.Error);
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (17)
Logging\AcceptanceTests.cs (11)
180Assert.Equal(LogLevel.Information, logCollector.LatestRecord.Level); 240Assert.Equal(LogLevel.Information, logCollector.LatestRecord.Level); 306Assert.All(logRecords, x => Assert.Equal(LogLevel.Information, x.Level)); 368Assert.Equal(LogLevel.Information, lastRecord.Level); 414Assert.Equal(LogLevel.Information, logCollector.LatestRecord.Level); 456Assert.Equal(LogLevel.Information, logCollector.LatestRecord.Level); 487Assert.All(logRecords, x => Assert.Equal(LogLevel.Information, x.Level)); 525Assert.All(logRecords, x => Assert.Equal(LogLevel.Information, x.Level)); 573Assert.Equal(LogLevel.Information, logCollector.LatestRecord.Level); 614Assert.Equal(LogLevel.Information, logCollector.LatestRecord.Level); 648Assert.Equal(LogLevel.Information, logCollector.LatestRecord.Level);
Logging\AcceptanceTests.Mvc.cs (5)
75Assert.Equal(LogLevel.Information, logRecord.Level); 110Assert.Equal(LogLevel.Information, logRecord.Level); 156Assert.Equal(LogLevel.Information, logRecord.Level); 200Assert.Equal(LogLevel.Information, logRecord.Level); 241Assert.Equal(LogLevel.Information, logRecord.Level);
Logging\AcceptanceTests.Routing.cs (1)
75Assert.Equal(LogLevel.Information, logRecord.Level);
Microsoft.Extensions.Diagnostics.HealthChecks.Common.Tests (1)
TelemetryHealthChecksPublisherTests.cs (1)
106Assert.Equal(expectedLogLevel, collector.LatestRecord.Level);
Microsoft.Extensions.Diagnostics.Testing (2)
Logging\FakeLogCollector.cs (1)
111if (_options.FilteredLevels.Count > 0 && !_options.FilteredLevels.Contains(record.Level))
Logging\FakeLogRecord.cs (1)
136var level = record.Level switch
Microsoft.Extensions.Diagnostics.Testing.Tests (4)
Logging\FakeLoggerTests.cs (4)
37Assert.Equal(LogLevel.Information, records[0].Level); 46Assert.Equal(LogLevel.Error, records[1].Level); 54Assert.Equal(LogLevel.Error, logger.LatestRecord.Level); 64Assert.Throws<InvalidOperationException>(() => logger.LatestRecord.Level);
Microsoft.Extensions.Http.Diagnostics.Tests (5)
Logging\AcceptanceTests.cs (3)
45Assert.Equal(LogLevel.Information, logRecord.Level); 77Assert.Equal(LogLevel.Error, firstLogRecord.Level); 86Assert.Equal(LogLevel.Information, secondLogRecord.Level);
Logging\HttpClientLoggerTest.cs (2)
967Assert.Equal(expectedLogLevel, logRecord.Level); 988Assert.Equal(LogLevel.Error, logRecord.Level);
Microsoft.Gen.Logging.Generated.Tests (78)
LoggerMessageAttributeTests.cs (1)
158Assert.Equal(expectedLevel, collector.LatestRecord.Level);
LogMethodTests.cs (46)
25Assert.Equal(LogLevel.Critical, collector.LatestRecord.Level); 32Assert.Equal(LogLevel.Critical, collector.LatestRecord.Level); 39Assert.Equal(LogLevel.Critical, collector.LatestRecord.Level); 52Assert.Equal(LogLevel.Critical, collector.LatestRecord.Level); 225Assert.Equal(LogLevel.Debug, collector.LatestRecord.Level); 233Assert.Equal(LogLevel.Error, collector.LatestRecord.Level); 241Assert.Equal(LogLevel.Debug, collector.LatestRecord.Level); 249Assert.Equal(LogLevel.Error, collector.LatestRecord.Level); 257Assert.Equal(LogLevel.Debug, collector.LatestRecord.Level); 265Assert.Equal(LogLevel.Error, collector.LatestRecord.Level); 273Assert.Equal(LogLevel.Debug, collector.LatestRecord.Level); 284Assert.Equal(LogLevel.Information, logRecord.Level); 295Assert.Equal(LogLevel.Trace, logRecord.Level); 310Assert.Equal(LogLevel.Trace, collector.LatestRecord.Level); 317Assert.Equal(LogLevel.Debug, collector.LatestRecord.Level); 324Assert.Equal(LogLevel.Debug, collector.LatestRecord.Level); 331Assert.Equal(LogLevel.Debug, collector.LatestRecord.Level); 338Assert.Equal(LogLevel.Warning, collector.LatestRecord.Level); 346Assert.Equal(LogLevel.Debug, collector.LatestRecord.Level); 363Assert.Equal(LogLevel.Error, collector.LatestRecord.Level); 370Assert.Equal(LogLevel.Trace, collector.LatestRecord.Level); 380Assert.Equal(LogLevel.Warning, logRecord.Level); 405Assert.Equal(LogLevel.Information, collector.LatestRecord.Level); 412Assert.Equal(LogLevel.Warning, collector.LatestRecord.Level); 419Assert.Equal(LogLevel.Error, collector.LatestRecord.Level); 426Assert.Equal(LogLevel.Critical, collector.LatestRecord.Level); 433Assert.Equal(LogLevel.None, collector.LatestRecord.Level); 440Assert.Equal((LogLevel)42, collector.LatestRecord.Level); 447Assert.Equal(LogLevel.Critical, collector.LatestRecord.Level); 454Assert.Equal(LogLevel.Information, collector.LatestRecord.Level); 461Assert.Equal(LogLevel.Warning, collector.LatestRecord.Level); 467Assert.Equal(LogLevel.Error, collector.LatestRecord.Level); 483Assert.Equal(LogLevel.Warning, collector.LatestRecord.Level); 490Assert.Equal(LogLevel.Information, collector.LatestRecord.Level); 497Assert.Equal(LogLevel.Error, collector.LatestRecord.Level); 528Assert.Equal(LogLevel.Trace, collector.LatestRecord.Level); 535Assert.Equal(LogLevel.Debug, collector.LatestRecord.Level); 542Assert.Equal(LogLevel.Debug, collector.LatestRecord.Level); 553Assert.Equal(LogLevel.Error, collector.LatestRecord.Level); 566Assert.Equal(LogLevel.Trace, collector.LatestRecord.Level); 577Assert.Equal(LogLevel.Warning, logRecord.Level); 592Assert.Equal(LogLevel.Error, collector.LatestRecord.Level); 599Assert.Equal(LogLevel.Debug, collector.LatestRecord.Level); 606Assert.Equal(LogLevel.Debug, collector.LatestRecord.Level); 613Assert.Equal(LogLevel.Debug, collector.LatestRecord.Level); 620Assert.Equal(LogLevel.Debug, collector.LatestRecord.Level);
LogPropertiesRedactionTests.cs (3)
56Assert.Equal(LogLevel.Information, collector.LatestRecord.Level); 110Assert.Equal(LogLevel.Warning, collector.LatestRecord.Level); 165Assert.Equal(LogLevel.None, collector.LatestRecord.Level);
LogPropertiesTests.cs (10)
229Assert.Equal(LogLevel.Debug, _logger.Collector.LatestRecord.Level); 302Assert.Equal(LogLevel.Information, _logger.Collector.LatestRecord.Level); 323Assert.Equal(LogLevel.Information, _logger.Collector.LatestRecord.Level); 343Assert.Equal(LogLevel.Information, _logger.Collector.LatestRecord.Level); 365Assert.Equal(LogLevel.Information, latestRecord.Level); 474Assert.Equal(LogLevel.Critical, latestRecord.Level); 501Assert.Equal(LogLevel.Information, latestRecord.Level); 525Assert.Equal(LogLevel.Debug, latestRecord.Level); 550Assert.Equal(LogLevel.Debug, latestRecord.Level); 576Assert.Equal(LogLevel.Debug, latestRecord.Level);
TagProviderTests.cs (18)
34Assert.Equal(LogLevel.Warning, latestRecord.Level); 57Assert.Equal(LogLevel.Information, latestRecord.Level); 84Assert.Equal(LogLevel.Debug, latestRecord.Level); 107Assert.Equal(LogLevel.Trace, latestRecord.Level); 128Assert.Equal(LogLevel.Trace, latestRecord.Level); 139Assert.Equal(LogLevel.Trace, latestRecord.Level); 163Assert.Equal(LogLevel.Warning, latestRecord.Level); 189Assert.Equal(LogLevel.Error, latestRecord.Level); 208Assert.Equal(LogLevel.Warning, latestRecord.Level); 227Assert.Equal(LogLevel.Warning, latestRecord.Level); 247Assert.Equal(LogLevel.Warning, latestRecord.Level); 269Assert.Equal(LogLevel.Debug, latestRecord.Level); 290Assert.Equal(LogLevel.Information, latestRecord.Level); 311Assert.Equal(LogLevel.Debug, latestRecord.Level); 331Assert.Equal(LogLevel.Warning, latestRecord.Level); 358Assert.Equal(LogLevel.Warning, latestRecord.Level); 396Assert.Equal(LogLevel.Warning, latestRecord.Level); 421Assert.Equal(LogLevel.Warning, latestRecord.Level);