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