netmash/Netmash.Logging.Api/DependencyInjectionExtensio...

21 lines
701 B
C#

using Microsoft.Extensions.DependencyInjection;
using Netmash.Logging.Api.Entities;
namespace Netmash.Logging.Api
{
public static class DependencyInjectionExtensions
{
public static void AddRequestLogging(this IServiceCollection services)
{
services.AddSingleton(new RequestLoggingConfiguration() { LogBody = false });
services.AddScoped<RequestLoggingAttribute>();
}
public static void AddRequestLogging(this IServiceCollection services, bool logBody)
{
services.AddSingleton(new RequestLoggingConfiguration() { LogBody = logBody });
services.AddScoped<RequestLoggingAttribute>();
}
}
}