autostep / AutoStep

AutoStep Testing Framework - Core Libraries and Components
MIT License
22 stars 1 forks source link

Direct Per-Thread Log Output to Structured Location for Each Scope #70

Closed alistairjevans closed 4 years ago

alistairjevans commented 4 years ago

At the moment, all log output is written to a single feed (the top-level one, typically a console or similar). In an parallel execution scenario, the log output order would be mixed between each thread.

We need to scope the ILogger instances provided to each level so that log output related to a given thread can be captured and stored in a structured manner, so that when we generate report output we can capture 'all logs for a given scenario' or 'all logs for a given feature'.

alistairjevans commented 4 years ago

Use the logging scopes; push a scope at each 'item'. Feature, Scenario, Step?.

At a certain point, when exiting a Feature/Scenario scope, we will flush log content to the 'actual' loggers.

Each TestExecutionContext will hold a queue of log messages. They will be written to the parent loggers in batches so they do not interleave too much with the other scenarios/features.

May need bufferLogs setting, defaults to true, but set to false when attached?