You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `ITestCaptureLogger.GetLogs()` method allows you to retrieve the logs within your test method. The property will be in sequence, timestamps will be incremental, however adjacent log entries created sufficiently close to one another may contain the same timestamp due to the resolution of the clock.
19
+
20
+
#### Returns
21
+
22
+
`IReadOnlyList<LogEntry>`: A read only list of log entries. See [LogEntry](log-entry.md)
23
+
24
+
##### Remarks
25
+
26
+
The result of the method can be passed into `RenderLogs()` extension method. See [Renderer](log-entry-renderer-extensions.md)
27
+
28
+
29
+
---
30
+
## GetLogEntriesWithExceptions()
31
+
32
+
The `ITestCaptureLogger.GetLogEntriesWithExceptions()` method gets all the log entries generated via this logger in sequential order that have exception objects attached to them.
33
+
34
+
```csharp
35
+
// Arrange
36
+
varlogger=newTestCaptureLogger();
37
+
38
+
// Act: Do something using the logger
39
+
40
+
// Assert
41
+
varlogs=logger.GetAllLogEntriesWithExceptions();
42
+
// logs is a read only list of LogEntry objects in sequential order.
43
+
```
44
+
45
+
#### Returns
46
+
47
+
`IReadOnlyList<LogEntry>`: A read only list of log entries. See [LogEntry](log-entry.md)
48
+
49
+
##### Remarks
50
+
51
+
The result of the method can be passed into `RenderLogs()` extension method. See [Renderer](log-entry-renderer-extensions.md)
52
+
53
+
---
54
+
## Reset()
55
+
56
+
Clears all the logs in the Logger.
57
+
58
+
If you reuse the same logger in multiple tests, be careful that the tests do not run in parallel with one another.
The `ITestCaptureLogger.GetLogs()` method allows you to retrieve the logs within your test method. The property will be in sequence, timestamps will be incremental, however adjacent log entries created sufficiently close to one another may contain the same timestamp due to the resolution of the clock.
19
+
20
+
#### Returns
21
+
22
+
`IReadOnlyList<LogEntry>`: A read only list of log entries. See [LogEntry](log-entry.md)
23
+
24
+
##### Remarks
25
+
26
+
The result of the method can be passed into `RenderLogs()` extension method. See [Renderer](log-entry-renderer-extensions.md)
27
+
28
+
29
+
---
30
+
## GetLogEntriesWithExceptions()
31
+
32
+
The `ITestCaptureLogger.GetLogEntriesWithExceptions()` method gets all the log entries generated via this logger in sequential order that have exception objects attached to them.
33
+
34
+
```csharp
35
+
// Arrange
36
+
varlogger=newTestCaptureLogger<MyService>();
37
+
38
+
// Act: Do something using the logger
39
+
40
+
// Assert
41
+
varlogs=logger.GetAllLogEntriesWithExceptions();
42
+
// logs is a read only list of LogEntry objects in sequential order.
43
+
```
44
+
45
+
#### Returns
46
+
47
+
`IReadOnlyList<LogEntry>`: A read only list of log entries. See [LogEntry](log-entry.md)
48
+
49
+
##### Remarks
50
+
51
+
The result of the method can be passed into `RenderLogs()` extension method. See [Renderer](log-entry-renderer-extensions.md)
52
+
53
+
---
54
+
## Reset()
55
+
56
+
Clears all the logs in the Logger.
57
+
58
+
If you reuse the same logger in multiple tests, be careful that the tests do not run in parallel with one another.
Copy file name to clipboardExpand all lines: release-notes/wip-release-notes.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,10 +4,18 @@
4
4
5
5
Date: ???
6
6
7
+
### Breaking Changes
8
+
9
+
- Feature #123 changes the `TestCaptureLogger<T>` class to encapsulate an instance of `TestCaptureLogger` rather than inherit from it. If you're code relied on `TestCaptureLogger<T>` inheriting from `TestCaptureLogger` then it will likely break.
- Potential breaking change: `TestCaptureLogger<T>` no longer inherits from `TestCaptureLogger`.
17
+
- Add `ITestCaptureLogger` and have `TestCaptureLogger` and `TestCaptureLogger<T>` be concrete implementations of the interface so you can reference the interface and not care which concrete implementation you have.
18
+
11
19
### Miscellaneous
12
20
13
21
-#164: Update pipeline.
@@ -17,6 +25,3 @@ Date: ???
17
25
-#166 Update package references:
18
26
- .NET 8.0 targets:
19
27
- Bump Microsoft.Extensions.Logging.Abstractions to 8.0.1
0 commit comments