-
Notifications
You must be signed in to change notification settings - Fork 1
High Performance Logging, XUnit ITestOutputHelper
DUONG Phu-Hiep edited this page Mar 8, 2024
·
2 revisions
https://learn.microsoft.com/en-us/dotnet/core/extensions/high-performance-logging
using Microsoft.Extensions.Logging;
public static partial class LoggerMessageDefGen
{
[LoggerMessage(EventId = 0, Level = LogLevel.Information, Message = "Send request {message}")]
public static partial void LogSendRequest(this ILogger logger, string message);
}
using Microsoft.Extensions.Logging;
ILoggerFactory LogFactory = LoggerFactory.Create(conf =>
{
conf.AddConsole();
});
ILogger logger = LogFactory.CreateLogger("G");
logger.LogSendRequest("Hello World");
https://xunit.net/docs/capturing-output#output-in-extensions
dotnet test --logger "console;verbosity=detailed"
dotnet test -filter:DisplayName~MyTest --logger "console;verbosity=detailed"