22 lines
762 B
C#
22 lines
762 B
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
using System;
|
|
|
|
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
|
// See the LICENSE file or go to https://EonaCat.com/License for full license details.
|
|
|
|
namespace EonaCat.Logger.EonaCatCoreLogger.Extensions
|
|
{
|
|
public static class HttpLoggerFactoryExtensions
|
|
{
|
|
public static ILoggingBuilder AddEonaCatHttpLogger(this ILoggingBuilder builder, Action<HttpLoggerOptions> configure)
|
|
{
|
|
var options = new HttpLoggerOptions();
|
|
configure?.Invoke(options);
|
|
builder.Services.AddSingleton<ILoggerProvider>(new HttpLoggerProvider(options));
|
|
return builder;
|
|
}
|
|
}
|
|
|
|
}
|