netmash/NDB.Logging.Api/DependencyInjectionExtensio...

21 lines
693 B
C#

using Microsoft.Extensions.DependencyInjection;
using NDB.Logging.Api.Entities;
namespace NDB.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>();
}
}
}