mirror of https://github.com/dotnet/tye.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
2.0 KiB
50 lines
2.0 KiB
// Licensed to the .NET Foundation under one or more agreements.
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
using System;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging.Testing;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Microsoft.Extensions.Logging
|
|
{
|
|
public static class XunitLoggerFactoryExtensions
|
|
{
|
|
public static ILoggingBuilder AddXunit(this ILoggingBuilder builder, ITestOutputHelper output)
|
|
{
|
|
builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output));
|
|
return builder;
|
|
}
|
|
|
|
public static ILoggingBuilder AddXunit(this ILoggingBuilder builder, ITestOutputHelper output, LogLevel minLevel)
|
|
{
|
|
builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output, minLevel));
|
|
return builder;
|
|
}
|
|
|
|
public static ILoggingBuilder AddXunit(this ILoggingBuilder builder, ITestOutputHelper output, LogLevel minLevel, DateTimeOffset? logStart)
|
|
{
|
|
builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output, minLevel, logStart));
|
|
return builder;
|
|
}
|
|
|
|
public static ILoggerFactory AddXunit(this ILoggerFactory loggerFactory, ITestOutputHelper output)
|
|
{
|
|
loggerFactory.AddProvider(new XunitLoggerProvider(output));
|
|
return loggerFactory;
|
|
}
|
|
|
|
public static ILoggerFactory AddXunit(this ILoggerFactory loggerFactory, ITestOutputHelper output, LogLevel minLevel)
|
|
{
|
|
loggerFactory.AddProvider(new XunitLoggerProvider(output, minLevel));
|
|
return loggerFactory;
|
|
}
|
|
|
|
public static ILoggerFactory AddXunit(this ILoggerFactory loggerFactory, ITestOutputHelper output, LogLevel minLevel, DateTimeOffset? logStart)
|
|
{
|
|
loggerFactory.AddProvider(new XunitLoggerProvider(output, minLevel, logStart));
|
|
return loggerFactory;
|
|
}
|
|
}
|
|
}
|
|
|