-
-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Is your feature request related to a problem? Please describe.
We have many integration tests which start a web server (using WebApplicationFactory) and a client app that has its own host and service collection. Now both services, the server and the client, are writing log messages to the same output and it's hard to find out if a log message comes from the server or the client.
Describe the solution you'd like
I would like to add a custom prefix to all messages so I can easily distinguish if a message is from the server or the client.
A simple solution would be to add a new property to the XUnitLoggerOptions to define a custom prefix. Or a bit more generic solution would be to add a property that allows me to define a function where I can manipulate the message in any way before it gets logged.
A more complex solution would be to add support for custom formatters. The default console logger has support for it. Here is a sample how to add a custom prefix to all console logs using a custom formatter: https://learn.microsoft.com/en-us/dotnet/core/extensions/console-log-formatter#implement-a-custom-formatter
Describe alternatives you've considered
I didn't find one