Stravaig Logging Diagnostics

Diagnostics for examining logs in automated tests.

Rendering Extensions

Extensions to help render captured logs in to the test output.

IEnumerable.RenderLogs()

Arguments

Examples

1
2
3
4
5
6
7
8
9
10
// Arrange
var logger = new TestCaptureLogger();

// Act: Do something using the logger

// Assert
var logs = logger.GetLogs();
logs.RenderLogs(
    le => $"[{le.Sequence} {le.LogLevel}] {le.FormattedMessage}",
    s => Console.WriteLine(s));

Remarks

There are some basic formatters already set up on the Formatter class. There is also a Console sink created on the Sink class. They can be used like the following:

1
logs.RenderLogs(Formatter.SimpleSequential, Sink.Console);