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

21 lines
701 B
C#
Raw Normal View History

using Microsoft.Extensions.DependencyInjection;
2023-01-12 01:01:36 +02:00
using Netmash.Logging.Api.Entities;
2023-01-12 01:01:36 +02:00
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>();
}
}
}