-
Notifications
You must be signed in to change notification settings - Fork 5
/
StartupExtensions.cs
33 lines (29 loc) · 1.02 KB
/
StartupExtensions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using Logging.Contracts;
using Logging.Middlewares;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
namespace Logging
{
public static class StartupExtensions
{
public static void RegisterLogger(this IServiceCollection services)
{
services.AddSingleton<ILogger, LoggerWrapper>();
services.AddSingleton<UsageLogger>();
services.AddSingleton<InfoLogger>();
services.AddSingleton<ErrorLogger>();
services.AddSingleton<PerformanceLogger>();
services.AddSingleton<DiagnosticLogger>();
}
public static IApplicationBuilder UseMvcExceptionLogger(
this IApplicationBuilder builder)
{
return builder.UseMiddleware<MvcExceptionLoggerMiddleware>();
}
public static IApplicationBuilder UseAPIExceptionLogger(
this IApplicationBuilder builder)
{
return builder.UseMiddleware<APIExceptionLoggerMiddleware>();
}
}
}